quantumVERB  1.0.0
A FOSS convolution reverb plugin
reverb::Equalizer Class Reference

#include <Equalizer.h>

Inheritance diagram for reverb::Equalizer:
Collaboration diagram for reverb::Equalizer:

Public Types

using Ptr = std::shared_ptr< Equalizer >
 
- Public Types inherited from reverb::Task
using Ptr = std::shared_ptr< Task >
 

Public Member Functions

 Equalizer (juce::AudioProcessor *processor, int numFilters=4)
 
virtual void updateParams (const juce::AudioProcessorValueTreeState &params, const juce::String &blockId) override
 Read processor parameters and update block parameters as necessary. More...
 
virtual AudioBlock exec (AudioBlock ir) override
 Processes the AudioBuffer input with the EQ filters. More...
 
virtual void updateSampleRate (double sr) override
 Update sample rate for task block. More...
 
void calibrateFilters ()
 Calibrates the individual filter gains so that the total gains are equal to the user defined values. More...
 
float getdBAmplitude (float freq)
 Returns the Equalizer amplitude response in dB at a given frequency. More...
 
int getNumFilters ()
 Returns the number of filters in the equalizer.
 
virtual bool needsToRun () const override
 Tells caller whether block must be run for current block. More...
 
- Public Member Functions inherited from reverb::Task
 Task (juce::AudioProcessor *processor)
 

Protected Attributes

juce::OwnedArray< FilterfilterSet
 
std::vector< float > EQGains
 
- Protected Attributes inherited from reverb::Task
juce::AudioProcessor * processor
 
bool mustExec = true
 

Additional Inherited Members

- Public Attributes inherited from reverb::Task
double sampleRate
 
- Protected Member Functions inherited from reverb::Task
float getParam (const juce::AudioProcessorValueTreeState &params, const juce::String &blockId) const
 Internal method used to get (and check) a parameter's value.
 

Detailed Description

The Equalizer class cimplements by default four Filter class instances -one low-shelf, two peak filters and one high-shelf - and calibrates their individual gains to balance out the stacking effect thus making sure that the EQ band gains are equal to the ones set by the user.

It acts as an interface between the GUI and the IIR filters. The class can support one low-shelf filter and one high-shelf with any number of peak filters in between; the total number is equal to the numFilters constructor argument. The filter instantiations are done in the class constructor.

Definition at line 30 of file Equalizer.h.

Member Function Documentation

◆ calibrateFilters()

void reverb::Equalizer::calibrateFilters ( )

Calibrates the individual filter gains so that the total gains are equal to the user defined values.

This function solves a linear equation system of N variables where N = number of filters in order to find the individual gains that, when stacked together, are equal to the user specified values at the frequencies of 0, 21000 Hz and at each single one of the peak filter center frequencies.

The use of decibels is necessary for the gain stacks to behave linearly. The algorithm can be used iteratively and is detailed in the Standford University lecture note available at https://ccrma.stanford.edu/courses/424/handouts.2004/424_Handout22_Filters4_LectureNotes.pdf

Exceptions
ConvergenceException

Definition at line 138 of file Equalizer.cpp.

◆ exec()

AudioBlock reverb::Equalizer::exec ( AudioBlock  ir)
overridevirtual

Processes the AudioBuffer input with the EQ filters.

Parameters
[in]irAudioBuffer to be processed

Implements reverb::Task.

Definition at line 106 of file Equalizer.cpp.

◆ getdBAmplitude()

float reverb::Equalizer::getdBAmplitude ( float  freq)

Returns the Equalizer amplitude response in dB at a given frequency.

Parameters
[in]freqFrequency at which the filter magnitude is evaluated

Definition at line 232 of file Equalizer.cpp.

◆ needsToRun()

bool reverb::Equalizer::needsToRun ( ) const
overridevirtual

Tells caller whether block must be run for current block.

May be overriden by IR blocks since these are executed sparingly.

Reimplemented from reverb::Task.

Definition at line 255 of file Equalizer.cpp.

◆ updateParams()

void reverb::Equalizer::updateParams ( const juce::AudioProcessorValueTreeState &  params,
const juce::String &  blockId 
)
overridevirtual

Read processor parameters and update block parameters as necessary.

Parameters
[in]paramsthe value tree containing the parameters
[in]blockIdthe Id of the relevant parameter block
Returns
True if any parameters were changed, false otherwise.

Implements reverb::Task.

Definition at line 66 of file Equalizer.cpp.

◆ updateSampleRate()

void reverb::Equalizer::updateSampleRate ( double  sr)
overridevirtual

Update sample rate for task block.

Compares new sample rate with previous value. If different, sets mustExec to true in order to re-run task for new sample rate. Store new sample rate value in object.

Parameters
[in]srSample rate

Reimplemented from reverb::Task.

Definition at line 119 of file Equalizer.cpp.


The documentation for this class was generated from the following files: