Clamp the biquad filter gain value to 0.00001

To actually prevent a potential divide-by-zero when the gain and reference
frequency are 0, instead of asserting.
This commit is contained in:
Chris Robinson 2023-01-28 03:22:10 -08:00
parent 02ec1e1208
commit 75276a427e

View File

@ -15,7 +15,7 @@ template<typename Real>
void BiquadFilterR<Real>::setParams(BiquadType type, Real f0norm, Real gain, Real rcpQ)
{
// Limit gain to -100dB
assert(gain > 0.00001f);
gain = std::max(gain, Real(0.00001));
const Real w0{al::numbers::pi_v<Real>*2.0f * f0norm};
const Real sin_w0{std::sin(w0)};