diff options
-rw-r--r-- | Alc/ALu.c | 32 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 2 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 2 |
3 files changed, 24 insertions, 12 deletions
@@ -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 + ); } } diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 4a5830a6..43e5bdf6 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -108,11 +108,13 @@ typedef struct ALsource { struct { ALfloat Gain; ALfloat GainHF; + ALfloat HFReference; } Direct; struct { struct ALeffectslot *Slot; ALfloat Gain; ALfloat GainHF; + ALfloat HFReference; } Send[MAX_SENDS]; /** Source needs to update its mixing parameters. */ diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index f0fb374f..e057acb1 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2314,10 +2314,12 @@ static ALvoid InitSourceParams(ALsource *Source) Source->Direct.Gain = 1.0f; Source->Direct.GainHF = 1.0f; + Source->Direct.HFReference = (ALfloat)LOWPASSFREQREF; for(i = 0;i < MAX_SENDS;i++) { Source->Send[i].Gain = 1.0f; Source->Send[i].GainHF = 1.0f; + Source->Send[i].HFReference = (ALfloat)LOWPASSFREQREF; } Source->NeedsUpdate = AL_TRUE; |