aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-04-30 09:33:00 -0700
committerChris Robinson <[email protected]>2012-04-30 09:33:00 -0700
commit010a66487d9b92f21d5b41c2d5956d8b79b58324 (patch)
tree3f4111c11cac98ce76e93d706328dddae0d8712d
parentaed35fd811f7aa5f1a9d2edb499e43d490ede96e (diff)
Use 2 chained one-pole filters for the wet path
-rw-r--r--Alc/ALu.c5
-rw-r--r--Alc/mixer.c12
-rw-r--r--OpenAL32/Include/alSource.h4
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;