14 #define M_PI 3.14159265358979323846f
29 friend class EqualizerMocked;
33 Filter(juce::AudioProcessor * processor,
float freq = 1000.0f,
float q = 0.71f,
float gain = 1.5f);
36 using Ptr = std::shared_ptr<
Filter>;
39 virtual void updateParams(
const juce::AudioProcessorValueTreeState& params,
40 const juce::String& blockId)
override;
45 static float todB(
float m)
47 return 20 * std::log10(m);
51 static float invdB(
float dB)
53 return pow(10, dB / 20);
66 virtual void buildFilter() = 0;
float getdBAmplitude(float freq)
Returns the filter amplitude response in dB at a given frequency.
float getAmplitude(float freq)
Returns the filter absolute amplitude response at a given frequency.
float getParam(const juce::AudioProcessorValueTreeState ¶ms, const juce::String &blockId) const
Internal method used to get (and check) a parameter's value.
virtual void buildFilter() override
Generates and sets the peak IIR filter coefficients according to the current filter parameters...
void setQ(float)
Sets the filter Q factor and updates the IIR filter coefficients (Meant to be used by Equalizer class...
void setFrequency(float)
Sets the filter frequency and updates the IIR filter coefficients (Meant to be used by Equalizer clas...
virtual void updateParams(const juce::AudioProcessorValueTreeState ¶ms, const juce::String &blockId) override
Updates parameters from processor parameter tree.
virtual AudioBlock exec(AudioBlock ir) override
Filters the audio in AudioSampleBuffer.
void setGain(float)
Sets the filter band gain and updates the IIR filter coefficients (Meant to be used by Equalizer clas...
virtual void buildFilter() override
Generates and sets the low-shelf IIR filter coefficients according to the current filter parameters...
virtual void buildFilter() override
Generates and sets the high-shelf IIR filter coefficients according to the current filter parameters...
Filter(juce::AudioProcessor *processor, float freq=1000.0f, float q=0.71f, float gain=1.5f)
Constructs a Filter object with optional frequency/gain/Q parameters.