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