29enum class StateVariableTPTFilterType
56template <
typename SampleType>
61 using Type = StateVariableTPTFilterType;
103 void reset (SampleType newValue);
116 const auto& inputBlock = context.getInputBlock();
117 auto& outputBlock = context.getOutputBlock();
118 const auto numChannels = outputBlock.getNumChannels();
119 const auto numSamples = outputBlock.getNumSamples();
121 jassert (inputBlock.getNumChannels() <= s1.
size());
122 jassert (inputBlock.getNumChannels() == numChannels);
123 jassert (inputBlock.getNumSamples() == numSamples);
125 if (context.isBypassed)
127 outputBlock.copyFrom (inputBlock);
131 for (
size_t channel = 0; channel < numChannels; ++channel)
133 auto*
inputSamples = inputBlock .getChannelPointer (channel);
134 auto*
outputSamples = outputBlock.getChannelPointer (channel);
136 for (
size_t i = 0; i < numSamples; ++i)
140 #if JUCE_DSP_ENABLE_SNAP_TO_ZERO
157 double sampleRate = 44100.0;
158 Type filterType = Type::lowpass;
159 SampleType cutoffFrequency =
static_cast<SampleType
> (1000.0),
160 resonance =
static_cast<SampleType
> (1.0 /
std::sqrt (2.0));
An IIR filter that can perform low, band and high-pass filtering on an audio signal,...
StateVariableTPTFilter()
Constructor.
SampleType getResonance() const noexcept
Returns the resonance of the filter.
void snapToZero() noexcept
Ensure that the state variables are rounded to zero if the state variables are denormals.
void process(const ProcessContext &context) noexcept
Processes the input and output samples supplied in the processing context.
void setType(Type newType)
Sets the filter type.
void prepare(const ProcessSpec &spec)
Initialises the filter.
SampleType getCutoffFrequency() const noexcept
Returns the cutoff frequency of the filter.
void setResonance(SampleType newResonance)
Sets the resonance of the filter.
void reset()
Resets the internal state variables of the filter.
SampleType processSample(int channel, SampleType inputValue)
Processes one sample at a time on a given channel.
void setCutoffFrequency(SampleType newFrequencyHz)
Sets the cutoff frequency of the filter.
Type getType() const noexcept
Returns the type of the filter.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...