From 080b0cea8ba4c21f898c18b70187822cd18f2eb6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 21 Dec 2016 21:35:50 -0800 Subject: Reorder filter coefficients --- Alc/effects/equalizer.c | 16 ++++++++-------- Alc/effects/modulator.c | 4 ++-- OpenAL32/Include/alFilter.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 1a63b418..13826a3b 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -146,11 +146,11 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * /* Copy the filter coefficients for the other input channels. */ for(i = 1;i < MAX_EFFECT_CHANNELS;i++) { - state->filter[0][i].a1 = state->filter[0][0].a1; - state->filter[0][i].a2 = state->filter[0][0].a2; state->filter[0][i].b0 = state->filter[0][0].b0; state->filter[0][i].b1 = state->filter[0][0].b1; state->filter[0][i].b2 = state->filter[0][0].b2; + state->filter[0][i].a1 = state->filter[0][0].a1; + state->filter[0][i].a2 = state->filter[0][0].a2; } gain = props->Equalizer.Mid1Gain; @@ -162,11 +162,11 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) { - state->filter[1][i].a1 = state->filter[1][0].a1; - state->filter[1][i].a2 = state->filter[1][0].a2; state->filter[1][i].b0 = state->filter[1][0].b0; state->filter[1][i].b1 = state->filter[1][0].b1; state->filter[1][i].b2 = state->filter[1][0].b2; + state->filter[1][i].a1 = state->filter[1][0].a1; + state->filter[1][i].a2 = state->filter[1][0].a2; } gain = props->Equalizer.Mid2Gain; @@ -178,11 +178,11 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) { - state->filter[2][i].a1 = state->filter[2][0].a1; - state->filter[2][i].a2 = state->filter[2][0].a2; state->filter[2][i].b0 = state->filter[2][0].b0; state->filter[2][i].b1 = state->filter[2][0].b1; state->filter[2][i].b2 = state->filter[2][0].b2; + state->filter[2][i].a1 = state->filter[2][0].a1; + state->filter[2][i].a2 = state->filter[2][0].a2; } gain = sqrtf(props->Equalizer.HighGain); @@ -192,11 +192,11 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) { - state->filter[3][i].a1 = state->filter[3][0].a1; - state->filter[3][i].a2 = state->filter[3][0].a2; state->filter[3][i].b0 = state->filter[3][0].b0; state->filter[3][i].b1 = state->filter[3][0].b1; state->filter[3][i].b2 = state->filter[3][0].b2; + state->filter[3][i].a1 = state->filter[3][0].a1; + state->filter[3][i].a2 = state->filter[3][0].a2; } } diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 247cdf61..6d096048 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -137,11 +137,11 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice * for(i = 0;i < MAX_EFFECT_CHANNELS;i++) { - state->Filter[i].a1 = -a; - state->Filter[i].a2 = 0.0f; state->Filter[i].b0 = a; state->Filter[i].b1 = -a; state->Filter[i].b2 = 0.0f; + state->Filter[i].a1 = -a; + state->Filter[i].a2 = 0.0f; } STATIC_CAST(ALeffectState,state)->OutBuffer = Device->FOAOut.Buffer; diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index 1f7095bc..bec4d46b 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -42,8 +42,8 @@ typedef enum ALfilterType { typedef struct ALfilterState { ALfloat x[2]; /* History of two last input samples */ ALfloat y[2]; /* History of two last output samples */ - ALfloat a1, a2; /* Transfer function coefficients "a" (a0 is pre-applied) */ ALfloat b0, b1, b2; /* Transfer function coefficients "b" */ + ALfloat a1, a2; /* Transfer function coefficients "a" (a0 is pre-applied) */ } ALfilterState; /* Currently only a C-based filter process method is implemented. */ #define ALfilterState_process ALfilterState_processC -- cgit v1.2.3