From 343200d2296f8ceb14371d12d6032056ec7fb9a3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 11 May 2014 10:07:17 -0700 Subject: Store the filter reference frequency in the source --- Alc/ALu.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index 7135343d..07b6d501 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -582,18 +582,22 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) { ALfloat gain = maxf(0.01f, DryGainHF); + ALfloat hfscale = ALSource->Direct.HFReference / Frequency; for(c = 0;c < num_channels;c++) - ALfilterState_setParams(&src->Direct.LpFilter[c], - ALfilterType_HighShelf, gain, - (ALfloat)LOWPASSFREQREF/Frequency, 0.0f); + ALfilterState_setParams( + &src->Direct.LpFilter[c], ALfilterType_HighShelf, gain, + hfscale, 0.0f + ); } for(i = 0;i < NumSends;i++) { ALfloat gain = maxf(0.01f, WetGainHF[i]); + ALfloat hfscale = ALSource->Send[i].HFReference / Frequency; for(c = 0;c < num_channels;c++) - ALfilterState_setParams(&src->Send[i].LpFilter[c], - ALfilterType_HighShelf, gain, - (ALfloat)LOWPASSFREQREF/Frequency, 0.0f); + ALfilterState_setParams( + &src->Send[i].LpFilter[c], ALfilterType_HighShelf, gain, + hfscale, 0.0f + ); } } @@ -1079,16 +1083,20 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) { ALfloat gain = maxf(0.01f, DryGainHF); - ALfilterState_setParams(&src->Direct.LpFilter[0], - ALfilterType_HighShelf, gain, - (ALfloat)LOWPASSFREQREF/Frequency, 0.0f); + ALfloat hfscale = ALSource->Direct.HFReference / Frequency; + ALfilterState_setParams( + &src->Direct.LpFilter[0], ALfilterType_HighShelf, gain, + hfscale, 0.0f + ); } for(i = 0;i < NumSends;i++) { ALfloat gain = maxf(0.01f, WetGainHF[i]); - ALfilterState_setParams(&src->Send[i].LpFilter[0], - ALfilterType_HighShelf, gain, - (ALfloat)LOWPASSFREQREF/Frequency, 0.0f); + ALfloat hfscale = ALSource->Send[i].HFReference / Frequency; + ALfilterState_setParams( + &src->Send[i].LpFilter[0], ALfilterType_HighShelf, gain, + hfscale, 0.0f + ); } } -- cgit v1.2.3