aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-05-27 21:57:22 -0700
committerChris Robinson <[email protected]>2013-05-27 21:57:22 -0700
commit6556626055e9985251ebd782c8551839e6d67ac5 (patch)
tree49d8aa79dc8fc024fb7adc2abf5b61cced2f2fa6 /Alc/ALu.c
parent59a38442acd9290f9bc95258bfcd854ad422c305 (diff)
Simplify and fix some filter gain calculations
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 70b5c80a..57dfa30f 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -452,7 +452,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
{
- ALfloat gain = maxf(0.001f, DryGainHF);
+ ALfloat gain = maxf(0.001f, sqrtf(DryGainHF));
for(c = 0;c < num_channels;c++)
ALfilterState_setParams(&ALSource->Params.Direct.Filter[c],
ALfilterType_LowPass, gain,
@@ -460,7 +460,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
for(i = 0;i < NumSends;i++)
{
- ALfloat gain = maxf(0.001f, WetGainHF[i]);
+ ALfloat gain = maxf(0.001f, sqrtf(WetGainHF[i]));
for(c = 0;c < num_channels;c++)
ALfilterState_setParams(&ALSource->Params.Send[i].Filter[c],
ALfilterType_LowPass, gain,
@@ -901,13 +901,19 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
ALSource->Params.Send[i].Gain = WetGain[i];
- ALfilterState_setParams(&ALSource->Params.Direct.Filter[0],
- ALfilterType_LowPass, maxf(0.001f, DryGainHF),
- (ALfloat)LOWPASSFREQREF/Frequency, 0.0f);
+ {
+ ALfloat gain = maxf(0.001f, sqrtf(DryGainHF));
+ ALfilterState_setParams(&ALSource->Params.Direct.Filter[0],
+ ALfilterType_LowPass, gain,
+ (ALfloat)LOWPASSFREQREF/Frequency, 0.0f);
+ }
for(i = 0;i < NumSends;i++)
+ {
+ ALfloat gain = maxf(0.001f, sqrtf(WetGainHF[i]));
ALfilterState_setParams(&ALSource->Params.Send[i].Filter[0],
- ALfilterType_LowPass, maxf(0.001f, WetGainHF[i]),
+ ALfilterType_LowPass, gain,
(ALfloat)LOWPASSFREQREF/Frequency, 0.0f);
+ }
}