Mercurial > hg > yjdafx13bpr
view BassPedalRackPlugin/PluginProcessor.h @ 0:2cd427e000b0
initial commit
author | Yannick JACOB <y.jacob@se12.qmul.ac.uk> |
---|---|
date | Tue, 03 Sep 2013 12:53:16 +0100 |
parents | |
children |
line wrap: on
line source
/* ============================================================================== This file was auto-generated! It contains the basic startup code for a Juce application. ============================================================================== */ #ifndef __PLUGINPROCESSOR_H_4693CB6E__ #define __PLUGINPROCESSOR_H_4693CB6E__ #include "../JuceLibraryCode/JuceHeader.h" //============================================================================== /** */ class BassPedalRackProcessor : public AudioProcessor { public: //============================================================================== BassPedalRackProcessor(); ~BassPedalRackProcessor(); //============================================================================== void prepareToPlay (double sampleRate, int samplesPerBlock); void releaseResources(); void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages); //============================================================================== AudioProcessorEditor* createEditor(); bool hasEditor() const; //============================================================================== const String getName() const; int getNumParameters(); float getParameter (int index); void setParameter (int index, float newValue); const String getParameterName (int index); const String getParameterText (int index); const String getInputChannelName (int channelIndex) const; const String getOutputChannelName (int channelIndex) const; bool isInputChannelStereoPair (int index) const; bool isOutputChannelStereoPair (int index) const; bool silenceInProducesSilenceOut() const; bool acceptsMidi() const; bool producesMidi() const; double getTailLengthSeconds() const; //============================================================================== int getNumPrograms(); int getCurrentProgram(); void setCurrentProgram (int index); const String getProgramName (int index); void changeProgramName (int index, const String& newName); //============================================================================== void getStateInformation (MemoryBlock& destData); void setStateInformation (const void* data, int sizeInBytes); //============================================================================== // these are used to persist the UI's size - the values are stored along with the // filter's other parameters, and the UI component will update them when it gets // resized. int lastUIWidth_, lastUIHeight_; enum Parameters { kMixParam = 0, kLowCutParam, kIndexParam, kGainParam, kHighCutParam, kGainTreParam, kGainMidParam, kGainLowParam, kGain1Param, kGain2Param, kGain3Param, kGain4Param, kGain5Param, kGain6Param, kGain7Param, kGain8Param, kGain9Param, kNumParameters }; //Distortion related parameters float index_; //Distortion index (x = x*index_) //gainN is the gain of the Nth Chebychev polynomial => gain of the Nth harmonic for a sinusoid float gain1_, gain2_, gain3_, gain4_, gain5_, gain6_, gain7_, gain8_, gain9_; float gain_; //Overall gain of the amp => volume int lowCut_, highCut_; //indices of the low pass filter (0 is allpass, max is nopass) float mix_; //Mix between the low and high (0 is only low, 1 is only high) float bassGain_, midGain_, trebleGain_; //gains for Low, Mid and Treble private: //Variables for tones //temp variable for polynomial of tone control //lower case for transfer function, capital for filter coefficent //RC is the system's characterstic time (2 and 3 are respectivly square and cube of that) double a1_, a2_, a3_, b1_, b2_, b3_, RC_, RC2_, RC3_, A0,A1,A2,A3,B0,B1,B2,B3; double fsd_, fsd2_, fsd3_;//sampling frequency, then squared and cubed int a0_; //Circular Buffers double memIn_[3]; //input double memOut_[3]; //output int currInd_; //indice in the circular buffers //Memory for stereo double tonStackIn_[6]; //input double tonStackOut_[6]; //output bool toneStack_, shaper_; //if tone Stack(or shaper) is applied //Variables for Chebychev distortion double coeffs_[10]; //Coefficient fo the polynomial float scale_; //scale to attenuate the gain of the distortion //Variables for high and low pass filters double lastIn_[151]; //input circular buffer double inputMem_[302]; //Memory for stereo int filterLength_; //length of the filters int filterInd_; //indice for the circular buffer //Update distortion coefficients void changeCoefficients(int kcase); //kcase enable to only update relevant coefficients //Update the tone coefficients void changeToneStack(); //Save and load previous buffer for stereo handling void saveMem(int channel); void loadMem(int channel); //Apply low and high pass filter double* applyFilter(float input); //Apply Chebychev Distotion float shaper(float x); //Apply Tone control float applyToneStack(float); //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BassPedalRackProcessor); }; #endif // __PLUGINPROCESSOR_H_4693CB6E__