30template <
typename SampleType>
37template <
typename SampleType>
40 filterType = newValue;
43template <
typename SampleType>
48 cutoffFrequency = newValue;
53template <
typename SampleType>
59 sampleRate =
spec.sampleRate;
60 s1.resize (
spec.numChannels);
66template <
typename SampleType>
69 reset (
static_cast<SampleType
> (0));
72template <
typename SampleType>
75 std::fill (s1.begin(), s1.end(), newValue);
79template <
typename SampleType>
82 auto& s = s1[(
size_t) channel];
90 case Type::lowpass:
return y;
100template <
typename SampleType>
104 util::snapToZero (s);
108template <
typename SampleType>
A first order filter class using the TPT (Topology-Preserving Transform) structure.
void prepare(const ProcessSpec &spec)
Initialises the filter.
void snapToZero() noexcept
Ensure that the state variables are rounded to zero if the state variables are denormals.
SampleType processSample(int channel, SampleType inputValue)
Processes one sample at a time on a given channel.
FirstOrderTPTFilter()
Constructor.
void setType(Type newType)
Sets the filter type.
void setCutoffFrequency(SampleType newFrequencyHz)
Sets the cutoff frequency of the filter.
void reset()
Resets the internal state variables 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...
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Returns true if a value is at least zero, and also below a specified upper limit.
Commonly used mathematical constants.
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...