Rename input_gain to b0

This commit is contained in:
Chris Robinson 2016-07-26 00:03:44 -07:00
parent 0a693d039a
commit 11b38e1190
6 changed files with 13 additions and 14 deletions

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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] -

View File

@ -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] -

View File

@ -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;
}