26template <std::
floating_po
int FloatType>
29 static_assert (! std::is_const<FloatType>::value,
"FloatType is must NOT be const.");
33 : samplePeriod (FloatType (1.0) / sampleRate)
41 samplePeriod = FloatType (1.0) / newSampleRate;
50 coef = (ame::twoPi<FloatType> * cutOffFrequency * samplePeriod) / (ame::twoPi<FloatType> * cutOffFrequency * samplePeriod + 1);
59 assert (0.0f < newRawCoefficient && newRawCoefficient <= 1.0f);
60 coef = newRawCoefficient;
75 FloatType
process (FloatType input)
noexcept
77 lastOutput = coef * input + (FloatType (1.0) - coef) * lastOutput;
82 FloatType coef { 1.0 };
83 FloatType lastOutput {};
84 FloatType samplePeriod { 1.0f / 48000.0f };
RC low-pass filter for parameter smoothing.
Definition: ame_RcLowPass.hpp:28
void setCutOffFrequency(FloatType cutOffFrequency) noexcept
LPF cutoff.
Definition: ame_RcLowPass.hpp:48
void setRawCoefficient(FloatType newRawCoefficient)
Set raw coefficient value.
Definition: ame_RcLowPass.hpp:57
void setSampleRate(FloatType newSampleRate) noexcept
Set new sampleRate.
Definition: ame_RcLowPass.hpp:39
FloatType getRawCoefficient() const noexcept
Get raw value of coefficient.
Definition: ame_RcLowPass.hpp:66
FloatType process(FloatType input) noexcept
Process filter.
Definition: ame_RcLowPass.hpp:75