aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALu.c12
-rw-r--r--Alc/alcEcho.c6
-rw-r--r--OpenAL32/Include/alFilter.h2
-rw-r--r--OpenAL32/Include/alSource.h2
4 files changed, 13 insertions, 9 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index a8371367..1d1878af 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -181,9 +181,9 @@ __inline ALuint aluChannelsFromFormat(ALenum format)
}
-static __inline ALfloat lpFilter4P(FILTER *iir, ALfloat input)
+static __inline ALfloat lpFilter4P(FILTER *iir, ALuint offset, ALfloat input)
{
- ALfloat *history = iir->history;
+ ALfloat *history = &iir->history[offset];
ALfloat a = iir->coeff;
ALfloat output = input;
@@ -199,9 +199,9 @@ static __inline ALfloat lpFilter4P(FILTER *iir, ALfloat input)
return output;
}
-static __inline ALfloat lpFilter2P(FILTER *iir, ALuint chan, ALfloat input)
+static __inline ALfloat lpFilter2P(FILTER *iir, ALuint offset, ALfloat input)
{
- ALfloat *history = &iir->history[chan*2];
+ ALfloat *history = &iir->history[offset];
ALfloat a = iir->coeff;
ALfloat output = input;
@@ -1179,7 +1179,7 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
value = lerp(Data[k], Data[k+1], DataPosFrac);
//Direct path final mix buffer and panning
- outsamp = lpFilter4P(DryFilter, value);
+ outsamp = lpFilter4P(DryFilter, 0, value);
DryBuffer[j][FRONT_LEFT] += outsamp*DrySend[FRONT_LEFT];
DryBuffer[j][FRONT_RIGHT] += outsamp*DrySend[FRONT_RIGHT];
DryBuffer[j][SIDE_LEFT] += outsamp*DrySend[SIDE_LEFT];
@@ -1219,7 +1219,7 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
for(i = 0;i < Channels;i++) \
{ \
value = lerp(Data[k*Channels + i], Data[(k+1)*Channels + i], DataPosFrac); \
- values[i] = lpFilter2P(DryFilter, chans[i], value)*DrySend[chans[i]]; \
+ values[i] = lpFilter2P(DryFilter, chans[i]*2, value)*DrySend[chans[i]]; \
} \
for(out = 0;out < OUTPUTCHANNELS;out++) \
{ \
diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c
index cbc57a03..f6606bfa 100644
--- a/Alc/alcEcho.c
+++ b/Alc/alcEcho.c
@@ -48,7 +48,9 @@ struct ALechoState {
ALfloat GainR;
ALfloat FeedGain;
+
FILTER iirFilter;
+ ALfloat history[2];
};
// Find the next power of 2. Actually, this will return the input value if
@@ -100,8 +102,8 @@ ALechoState *EchoCreate(ALCcontext *Context)
state->GainL = 0.0f;
state->GainR = 0.0f;
- for(i = 0;i < sizeof(state->iirFilter.history)/sizeof(state->iirFilter.history[0]);i++)
- state->iirFilter.history[i] = 0.0f;
+ for(i = 0;i < sizeof(state->history)/sizeof(state->history[0]);i++)
+ state->history[i] = 0.0f;
state->iirFilter.coeff = 0.0f;
return state;
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index 413f2a12..40fff4fd 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -9,8 +9,8 @@ extern "C" {
#endif
typedef struct {
- ALfloat history[OUTPUTCHANNELS*2];
ALfloat coeff;
+ ALfloat history[0];
} FILTER;
#define AL_FILTER_TYPE 0x8001
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 28a85029..2bd7aac2 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -69,6 +69,7 @@ typedef struct ALsource
struct ALeffectslot *Slot;
ALfilter WetFilter;
FILTER iirFilter;
+ ALfloat history[2];
} Send[MAX_SENDS];
ALboolean DryGainHFAuto;
@@ -77,6 +78,7 @@ typedef struct ALsource
ALfloat OuterGainHF;
FILTER iirFilter;
+ ALfloat history[OUTPUTCHANNELS*2];
ALfloat AirAbsorptionFactor;