aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/equalizer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-22 18:07:41 -0800
committerChris Robinson <[email protected]>2017-02-22 18:07:41 -0800
commitd04cc28f33c5a21273fc42c023b41dbcfa89632b (patch)
treecbd5673166d0656cff03ed95d3deffe96c02be1a /Alc/effects/equalizer.c
parent629980d15ee8f87c916cefee79bbb692e34a1266 (diff)
Limit filter gains to -24dB
Diffstat (limited to 'Alc/effects/equalizer.c')
-rw-r--r--Alc/effects/equalizer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index 13826a3b..36683d79 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -138,7 +138,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
* filters' gain is for the reference frequency, which is the centerpoint
* of the transition band.
*/
- gain = sqrtf(props->Equalizer.LowGain);
+ gain = maxf(sqrtf(props->Equalizer.LowGain), 0.0625f); /* Limit -24dB */
freq_mult = props->Equalizer.LowCutoff/frequency;
ALfilterState_setParams(&state->filter[0][0], ALfilterType_LowShelf,
gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f)
@@ -153,7 +153,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
state->filter[0][i].a2 = state->filter[0][0].a2;
}
- gain = props->Equalizer.Mid1Gain;
+ gain = maxf(props->Equalizer.Mid1Gain, 0.0625f);
freq_mult = props->Equalizer.Mid1Center/frequency;
ALfilterState_setParams(&state->filter[1][0], ALfilterType_Peaking,
gain, freq_mult, calc_rcpQ_from_bandwidth(
@@ -169,7 +169,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
state->filter[1][i].a2 = state->filter[1][0].a2;
}
- gain = props->Equalizer.Mid2Gain;
+ gain = maxf(props->Equalizer.Mid2Gain, 0.0625f);
freq_mult = props->Equalizer.Mid2Center/frequency;
ALfilterState_setParams(&state->filter[2][0], ALfilterType_Peaking,
gain, freq_mult, calc_rcpQ_from_bandwidth(
@@ -185,7 +185,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
state->filter[2][i].a2 = state->filter[2][0].a2;
}
- gain = sqrtf(props->Equalizer.HighGain);
+ gain = maxf(sqrtf(props->Equalizer.HighGain), 0.0625f);
freq_mult = props->Equalizer.HighCutoff/frequency;
ALfilterState_setParams(&state->filter[3][0], ALfilterType_HighShelf,
gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f)