aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/reverb.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-06-05 01:52:49 -0700
committerChris Robinson <[email protected]>2013-06-05 01:52:49 -0700
commita371de080b01d9ea9dc38dd386b5903f7e4d8282 (patch)
tree2d6ad48f76bf1580430d0d6aa3dbd2bf7ab2d047 /Alc/effects/reverb.c
parent0e0f70b2888c23debeefd80603f8c6f0c1ad4880 (diff)
Silence some clang warnings
Diffstat (limited to 'Alc/effects/reverb.c')
-rw-r--r--Alc/effects/reverb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 1fb30610..1db987c6 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -855,7 +855,14 @@ static inline ALfloat CalcDampingCoeff(ALfloat hfRatio, ALfloat length, ALfloat
// Damping is done with a 1-pole filter, so g needs to be squared.
g *= g;
- coeff = lpCoeffCalc(g, cw);
+ if(g < 0.9999f) /* 1-epsilon */
+ {
+ /* Be careful with gains < 0.001, as that causes the coefficient
+ * head towards 1, which will flatten the signal. */
+ g = maxf(g, 0.001f);
+ coeff = (1 - g*cw - sqrtf(2*g*(1-cw) - g*g*(1 - cw*cw))) /
+ (1 - g);
+ }
// Very low decay times will produce minimal output, so apply an
// upper bound to the coefficient.