From 010a66487d9b92f21d5b41c2d5956d8b79b58324 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 30 Apr 2012 09:33:00 -0700 Subject: Use 2 chained one-pole filters for the wet path --- Alc/ALu.c | 5 ++--- Alc/mixer.c | 12 ++++++------ OpenAL32/Include/alSource.h | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index 2777b0fe..d3965dfd 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -308,8 +308,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALSource->Params.Direct.iirFilter.coeff = lpCoeffCalc(DryGainHF, cw); for(i = 0;i < NumSends;i++) { - /* We use a one-pole filter, so we need to take the squared gain */ - ALfloat a = lpCoeffCalc(WetGainHF[i]*WetGainHF[i], cw); + ALfloat a = lpCoeffCalc(WetGainHF[i], cw); ALSource->Params.Send[i].iirFilter.coeff = a; } } @@ -762,7 +761,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALSource->Params.Direct.iirFilter.coeff = lpCoeffCalc(DryGainHF, cw); for(i = 0;i < NumSends;i++) { - ALfloat a = lpCoeffCalc(WetGainHF[i]*WetGainHF[i], cw); + ALfloat a = lpCoeffCalc(WetGainHF[i], cw); ALSource->Params.Send[i].iirFilter.coeff = a; } } diff --git a/Alc/mixer.c b/Alc/mixer.c index e925a5e8..75ede3dc 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -350,16 +350,16 @@ static void MixSend_##sampler(ALsource *Source, ALuint sendidx, \ \ if(OutPos == 0) \ { \ - value = sampler(data + pos*NumChannels + i, NumChannels,frac); \ + value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ \ - value = lpFilter1PC(WetFilter, i, value); \ + value = lpFilter2PC(WetFilter, i, value); \ WetClickRemoval[0] -= value * WetSend; \ } \ for(BufferIdx = 0;BufferIdx < BufferSize;BufferIdx++) \ { \ - value = sampler(data + pos*NumChannels + i, NumChannels,frac); \ + value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ \ - value = lpFilter1P(WetFilter, i, value); \ + value = lpFilter2P(WetFilter, i, value); \ WetBuffer[OutPos] += value * WetSend; \ \ frac += increment; \ @@ -369,9 +369,9 @@ static void MixSend_##sampler(ALsource *Source, ALuint sendidx, \ } \ if(OutPos == SamplesToDo) \ { \ - value = sampler(data + pos*NumChannels + i, NumChannels,frac); \ + value = sampler(data + pos*NumChannels + i, NumChannels, frac); \ \ - value = lpFilter1PC(WetFilter, i, value); \ + value = lpFilter2PC(WetFilter, i, value); \ WetPendingClicks[0] += value * WetSend; \ } \ OutPos -= BufferSize; \ diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 88ced697..f76f618d 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -63,9 +63,9 @@ typedef struct SendParams { * output buffer. */ ALfloat Gain; - /* A low-pass filter, using a one-pole filter. */ + /* A low-pass filter, using 2 chained one-pole filters. */ FILTER iirFilter; - ALfloat history[MAXCHANNELS]; + ALfloat history[MAXCHANNELS*2]; } SendParams; -- cgit v1.2.3