annotate BassPedalRackPlugin/PluginProcessor.h @ 2:13ec2fa02a26 tip

(none)
author Yannick JACOB <y.jacob@se12.qmul.ac.uk>
date Tue, 03 Sep 2013 15:33:42 +0100
parents 2cd427e000b0
children
rev   line source
y@0 1 /*
y@0 2 ==============================================================================
y@0 3
y@0 4 This file was auto-generated!
y@0 5
y@0 6 It contains the basic startup code for a Juce application.
y@0 7
y@0 8 ==============================================================================
y@0 9 */
y@0 10
y@0 11 #ifndef __PLUGINPROCESSOR_H_4693CB6E__
y@0 12 #define __PLUGINPROCESSOR_H_4693CB6E__
y@0 13
y@0 14 #include "../JuceLibraryCode/JuceHeader.h"
y@0 15
y@0 16
y@0 17 //==============================================================================
y@0 18 /**
y@0 19 */
y@0 20 class BassPedalRackProcessor : public AudioProcessor
y@0 21 {
y@0 22 public:
y@0 23 //==============================================================================
y@0 24 BassPedalRackProcessor();
y@0 25 ~BassPedalRackProcessor();
y@0 26
y@0 27 //==============================================================================
y@0 28 void prepareToPlay (double sampleRate, int samplesPerBlock);
y@0 29 void releaseResources();
y@0 30
y@0 31 void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
y@0 32
y@0 33 //==============================================================================
y@0 34 AudioProcessorEditor* createEditor();
y@0 35 bool hasEditor() const;
y@0 36
y@0 37 //==============================================================================
y@0 38 const String getName() const;
y@0 39
y@0 40 int getNumParameters();
y@0 41
y@0 42 float getParameter (int index);
y@0 43 void setParameter (int index, float newValue);
y@0 44
y@0 45 const String getParameterName (int index);
y@0 46 const String getParameterText (int index);
y@0 47
y@0 48 const String getInputChannelName (int channelIndex) const;
y@0 49 const String getOutputChannelName (int channelIndex) const;
y@0 50 bool isInputChannelStereoPair (int index) const;
y@0 51 bool isOutputChannelStereoPair (int index) const;
y@0 52
y@0 53 bool silenceInProducesSilenceOut() const;
y@0 54 bool acceptsMidi() const;
y@0 55 bool producesMidi() const;
y@0 56
y@0 57 double getTailLengthSeconds() const;
y@0 58
y@0 59 //==============================================================================
y@0 60 int getNumPrograms();
y@0 61 int getCurrentProgram();
y@0 62 void setCurrentProgram (int index);
y@0 63 const String getProgramName (int index);
y@0 64 void changeProgramName (int index, const String& newName);
y@0 65
y@0 66 //==============================================================================
y@0 67 void getStateInformation (MemoryBlock& destData);
y@0 68 void setStateInformation (const void* data, int sizeInBytes);
y@0 69
y@0 70 //==============================================================================
y@0 71
y@0 72 // these are used to persist the UI's size - the values are stored along with the
y@0 73 // filter's other parameters, and the UI component will update them when it gets
y@0 74 // resized.
y@0 75 int lastUIWidth_, lastUIHeight_;
y@0 76
y@0 77
y@0 78
y@0 79 enum Parameters
y@0 80 {
y@0 81 kMixParam = 0,
y@0 82 kLowCutParam,
y@0 83 kIndexParam,
y@0 84 kGainParam,
y@0 85 kHighCutParam,
y@0 86 kGainTreParam,
y@0 87 kGainMidParam,
y@0 88 kGainLowParam,
y@0 89 kGain1Param,
y@0 90 kGain2Param,
y@0 91 kGain3Param,
y@0 92 kGain4Param,
y@0 93 kGain5Param,
y@0 94 kGain6Param,
y@0 95 kGain7Param,
y@0 96 kGain8Param,
y@0 97 kGain9Param,
y@0 98 kNumParameters
y@0 99 };
y@0 100 //Distortion related parameters
y@0 101 float index_; //Distortion index (x = x*index_)
y@0 102 //gainN is the gain of the Nth Chebychev polynomial => gain of the Nth harmonic for a sinusoid
y@0 103 float gain1_, gain2_, gain3_, gain4_, gain5_, gain6_, gain7_, gain8_, gain9_;
y@0 104
y@0 105 float gain_; //Overall gain of the amp => volume
y@0 106
y@0 107 int lowCut_, highCut_; //indices of the low pass filter (0 is allpass, max is nopass)
y@0 108 float mix_; //Mix between the low and high (0 is only low, 1 is only high)
y@0 109
y@0 110 float bassGain_, midGain_, trebleGain_; //gains for Low, Mid and Treble
y@0 111
y@0 112 private:
y@0 113
y@0 114 //Variables for tones
y@0 115 //temp variable for polynomial of tone control
y@0 116 //lower case for transfer function, capital for filter coefficent
y@0 117 //RC is the system's characterstic time (2 and 3 are respectivly square and cube of that)
y@0 118 double a1_, a2_, a3_, b1_, b2_, b3_, RC_, RC2_, RC3_, A0,A1,A2,A3,B0,B1,B2,B3;
y@0 119 double fsd_, fsd2_, fsd3_;//sampling frequency, then squared and cubed
y@0 120 int a0_;
y@0 121 //Circular Buffers
y@0 122 double memIn_[3]; //input
y@0 123 double memOut_[3]; //output
y@0 124 int currInd_; //indice in the circular buffers
y@0 125 //Memory for stereo
y@0 126 double tonStackIn_[6]; //input
y@0 127 double tonStackOut_[6]; //output
y@0 128
y@0 129 bool toneStack_, shaper_; //if tone Stack(or shaper) is applied
y@0 130
y@0 131 //Variables for Chebychev distortion
y@0 132 double coeffs_[10]; //Coefficient fo the polynomial
y@0 133 float scale_; //scale to attenuate the gain of the distortion
y@0 134
y@0 135 //Variables for high and low pass filters
y@0 136 double lastIn_[151]; //input circular buffer
y@0 137 double inputMem_[302]; //Memory for stereo
y@0 138 int filterLength_; //length of the filters
y@0 139 int filterInd_; //indice for the circular buffer
y@0 140
y@0 141
y@0 142 //Update distortion coefficients
y@0 143 void changeCoefficients(int kcase); //kcase enable to only update relevant coefficients
y@0 144 //Update the tone coefficients
y@0 145 void changeToneStack();
y@0 146 //Save and load previous buffer for stereo handling
y@0 147 void saveMem(int channel);
y@0 148 void loadMem(int channel);
y@0 149
y@0 150 //Apply low and high pass filter
y@0 151 double* applyFilter(float input);
y@0 152 //Apply Chebychev Distotion
y@0 153 float shaper(float x);
y@0 154 //Apply Tone control
y@0 155 float applyToneStack(float);
y@0 156
y@0 157 //==============================================================================
y@0 158 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BassPedalRackProcessor);
y@0 159
y@0 160 };
y@0 161
y@0 162 #endif // __PLUGINPROCESSOR_H_4693CB6E__