11namespace tracktion {
inline namespace engine
14LowPassPlugin::LowPassPlugin (PluginCreationInfo info) : Plugin (info)
16 auto um = getUndoManager();
18 frequencyValue.referTo (state, IDs::frequency, um, 4000.0f);
19 mode.referTo (state, IDs::mode, um,
"lowpass");
21 frequency = addParam (
"frequency",
TRANS(
"Frequency"), { 10.0f, 22000.0f },
25 frequency->attachToCurrentValue (frequencyValue);
28LowPassPlugin::~LowPassPlugin()
30 notifyListenersOfDeletion();
32 frequency->detachFromCurrentValue();
35const char* LowPassPlugin::xmlTypeName =
"lowpass";
37void LowPassPlugin::updateFilters()
39 const float newFreq = frequency->getCurrentValue();
40 const bool nowLowPass = isLowPass();
42 if (currentFilterFreq != newFreq || nowLowPass != isCurrentlyLowPass)
44 currentFilterFreq = newFreq;
45 isCurrentlyLowPass = nowLowPass;
48 :
juce::IIRCoefficients::makeHighPass (sampleRate, newFreq);
50 filter[0].setCoefficients (c);
51 filter[1].setCoefficients (c);
57 sampleRate = info.sampleRate;
59 for (
int i = 0; i < numElementsInArray (filter); ++i)
62 currentFilterFreq = 0;
66void LowPassPlugin::deinitialise()
Type * getWritePointer(int channelNumber) noexcept
int getNumChannels() const noexcept
static IIRCoefficients makeLowPass(double sampleRate, double frequency) noexcept
float getFloatValue() const noexcept
#define TRANS(stringLiteral)
int roundToInt(const FloatType value) noexcept
Passed into Plugins when they are being initialised, to give them useful contextual information that ...
The context passed to plugin render methods to provide it with buffers to fill.
int bufferNumSamples
The number of samples to write into the audio buffer.
juce::AudioBuffer< float > * destBuffer
The target audio buffer which needs to be filled.
int bufferStartSample
The index of the start point in the audio buffer from which data must be written.