aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-01-28 03:22:10 -0800
committerChris Robinson <[email protected]>2023-01-28 03:22:10 -0800
commit75276a427e8913b52c2b14aee4b414b94b7a7f9b (patch)
tree48f433ce9d06ae3cbe0f3c4f43ed48d9a822cc69
parent02ec1e12086c84015c98bd5fd166be6cccf29f5d (diff)
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.
-rw-r--r--core/filters/biquad.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/filters/biquad.cpp b/core/filters/biquad.cpp
index 470b1cd3..8e5ed17d 100644
--- a/core/filters/biquad.cpp
+++ b/core/filters/biquad.cpp
@@ -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)};