aboutsummaryrefslogtreecommitdiffstats
path: root/alc/effects
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-09 20:09:47 -0700
committerChris Robinson <[email protected]>2019-08-10 14:41:55 -0700
commit98029d64b96c2f5edc5dc1e290fa4d30a1338bb4 (patch)
tree20af999604ece4f66564a129484a8606931e7c69 /alc/effects
parent8f93656f5301b0db1bda15b4c79397f322cf18fe (diff)
Fix and clarify the peaking biquad filter
Diffstat (limited to 'alc/effects')
-rw-r--r--alc/effects/equalizer.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp
index a8e81b37..12183814 100644
--- a/alc/effects/equalizer.cpp
+++ b/alc/effects/equalizer.cpp
@@ -116,25 +116,26 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot,
ALfloat gain, f0norm;
/* Calculate coefficients for the each type of filter. Note that the shelf
- * filters' gain is for the reference frequency, which is the centerpoint
- * of the transition band.
+ * and peaking filters' gain is for the centerpoint of the transition band,
+ * meaning its dB needs to be doubled for the shelf or peak to reach the
+ * provided gain.
*/
- gain = maxf(sqrtf(props->Equalizer.LowGain), 0.0625f); /* Limit -24dB */
+ gain = maxf(std::sqrt(props->Equalizer.LowGain), 0.0625f); /* Limit -24dB */
f0norm = props->Equalizer.LowCutoff/frequency;
mChans[0].filter[0].setParams(BiquadType::LowShelf, gain, f0norm,
BiquadFilter::rcpQFromSlope(gain, 0.75f));
- gain = maxf(props->Equalizer.Mid1Gain, 0.0625f);
+ gain = maxf(std::sqrt(props->Equalizer.Mid1Gain), 0.0625f);
f0norm = props->Equalizer.Mid1Center/frequency;
mChans[0].filter[1].setParams(BiquadType::Peaking, gain, f0norm,
BiquadFilter::rcpQFromBandwidth(f0norm, props->Equalizer.Mid1Width));
- gain = maxf(props->Equalizer.Mid2Gain, 0.0625f);
+ gain = maxf(std::sqrt(props->Equalizer.Mid2Gain), 0.0625f);
f0norm = props->Equalizer.Mid2Center/frequency;
mChans[0].filter[2].setParams(BiquadType::Peaking, gain, f0norm,
BiquadFilter::rcpQFromBandwidth(f0norm, props->Equalizer.Mid2Width));
- gain = maxf(sqrtf(props->Equalizer.HighGain), 0.0625f);
+ gain = maxf(std::sqrt(props->Equalizer.HighGain), 0.0625f);
f0norm = props->Equalizer.HighCutoff/frequency;
mChans[0].filter[3].setParams(BiquadType::HighShelf, gain, f0norm,
BiquadFilter::rcpQFromSlope(gain, 0.75f));