diff options
author | Chris Robinson <[email protected]> | 2017-05-21 03:31:44 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-05-21 03:31:44 -0700 |
commit | 5691dceb38d7dfa6159c9c9b5358d094acc7e8a4 (patch) | |
tree | 063eb7a6ac469c6e1c8354f1be96a2503b697f7c /Alc | |
parent | edcdc1dae85246b8ae633d112cfd7dda93fdc8c9 (diff) |
Add a method to copy a filter's coefficients
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/effects/equalizer.c | 32 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 13 |
2 files changed, 6 insertions, 39 deletions
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 5e6a2a9a..030eacc9 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -145,13 +145,7 @@ 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].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; - } + ALfilterState_copyParams(&state->filter[0][i], &state->filter[0][0]); gain = maxf(props->Equalizer.Mid1Gain, 0.0625f); freq_mult = props->Equalizer.Mid1Center/frequency; @@ -161,13 +155,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * ) ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - 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; - } + ALfilterState_copyParams(&state->filter[1][i], &state->filter[1][0]); gain = maxf(props->Equalizer.Mid2Gain, 0.0625f); freq_mult = props->Equalizer.Mid2Center/frequency; @@ -177,13 +165,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * ) ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - 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; - } + ALfilterState_copyParams(&state->filter[2][i], &state->filter[2][0]); gain = maxf(sqrtf(props->Equalizer.HighGain), 0.0625f); freq_mult = props->Equalizer.HighCutoff/frequency; @@ -191,13 +173,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f) ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - 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; - } + ALfilterState_copyParams(&state->filter[3][i], &state->filter[3][0]); } static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 2c881512..f5d32d93 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -1336,17 +1336,8 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device gainlf, lfScale, calc_rcpQ_from_slope(gainlf, 1.0f)); for(i = 1;i < 4;i++) { - State->Filter[i].Lp.b0 = State->Filter[0].Lp.b0; - State->Filter[i].Lp.b1 = State->Filter[0].Lp.b1; - State->Filter[i].Lp.b2 = State->Filter[0].Lp.b2; - State->Filter[i].Lp.a1 = State->Filter[0].Lp.a1; - State->Filter[i].Lp.a2 = State->Filter[0].Lp.a2; - - State->Filter[i].Hp.b0 = State->Filter[0].Hp.b0; - State->Filter[i].Hp.b1 = State->Filter[0].Hp.b1; - State->Filter[i].Hp.b2 = State->Filter[0].Hp.b2; - State->Filter[i].Hp.a1 = State->Filter[0].Hp.a1; - State->Filter[i].Hp.a2 = State->Filter[0].Hp.a2; + ALfilterState_copyParams(&State->Filter[i].Lp, &State->Filter[0].Lp); + ALfilterState_copyParams(&State->Filter[i].Hp, &State->Filter[0].Hp); } /* Update the main effect delay and associated taps. */ |