diff options
-rw-r--r-- | Alc/effects/autowah.c | 2 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 8 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 2 | ||||
-rw-r--r-- | Alc/mixer_c.c | 8 | ||||
-rw-r--r-- | OpenAL32/Include/alFilter.h | 5 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 2 |
6 files changed, 13 insertions, 14 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index 648afc83..c8b70595 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -128,9 +128,9 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, state->LowPass.a1 = a[1] / a[0]; state->LowPass.a2 = a[2] / a[0]; + state->LowPass.b0 = b[0] / a[0]; state->LowPass.b1 = b[1] / a[0]; state->LowPass.b2 = b[2] / a[0]; - state->LowPass.input_gain = b[0] / a[0]; temps[it] = ALfilterState_processSingle(&state->LowPass, smp); } diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 25e36724..96676d34 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -131,9 +131,9 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * { 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].input_gain = state->filter[0][0].input_gain; state->filter[0][i].process = state->filter[0][0].process; } @@ -148,9 +148,9 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * { 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].input_gain = state->filter[1][0].input_gain; state->filter[1][i].process = state->filter[1][0].process; } @@ -165,9 +165,9 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * { 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].input_gain = state->filter[2][0].input_gain; state->filter[2][i].process = state->filter[2][0].process; } @@ -180,9 +180,9 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * { 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].input_gain = state->filter[3][0].input_gain; state->filter[3][i].process = state->filter[3][0].process; } } diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 0b0971b2..7e3e89b2 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -117,9 +117,9 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice * { 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].input_gain = a; state->Filter[i].process = ALfilterState_processC; } diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index f741e28f..7dca7a61 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -98,18 +98,18 @@ void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALuint i; if(numsamples > 1) { - dst[0] = filter->input_gain * src[0] + + dst[0] = filter->b0 * src[0] + filter->b1 * filter->x[0] + filter->b2 * filter->x[1] - filter->a1 * filter->y[0] - filter->a2 * filter->y[1]; - dst[1] = filter->input_gain * src[1] + + dst[1] = filter->b0 * src[1] + filter->b1 * src[0] + filter->b2 * filter->x[0] - filter->a1 * dst[0] - filter->a2 * filter->y[0]; for(i = 2;i < numsamples;i++) - dst[i] = filter->input_gain * src[i] + + dst[i] = filter->b0 * src[i] + filter->b1 * src[i-1] + filter->b2 * src[i-2] - filter->a1 * dst[i-1] - @@ -121,7 +121,7 @@ void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const } else if(numsamples == 1) { - dst[0] = filter->input_gain * src[0] + + dst[0] = filter->b0 * src[0] + filter->b1 * filter->x[0] + filter->b2 * filter->x[1] - filter->a1 * filter->y[0] - diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index 855bb534..8012e398 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -43,8 +43,7 @@ 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 b1, b2; /* Transfer function coefficients "b" (b0 is input_gain) */ - ALfloat input_gain; + ALfloat b0, b1, b2; /* Transfer function coefficients "b" */ void (*process)(struct ALfilterState *self, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples); } ALfilterState; @@ -83,7 +82,7 @@ inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample { ALfloat outsmp; - outsmp = filter->input_gain * sample + + outsmp = filter->b0 * sample + filter->b1 * filter->x[0] + filter->b2 * filter->x[1] - filter->a1 * filter->y[0] - diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 7b96263a..da447c27 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -429,9 +429,9 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g filter->a1 = a[1] / a[0]; filter->a2 = a[2] / a[0]; + filter->b0 = b[0] / a[0]; filter->b1 = b[1] / a[0]; filter->b2 = b[2] / a[0]; - filter->input_gain = b[0] / a[0]; filter->process = ALfilterState_processC; } |