aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/equalizer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-05-21 03:31:44 -0700
committerChris Robinson <[email protected]>2017-05-21 03:31:44 -0700
commit5691dceb38d7dfa6159c9c9b5358d094acc7e8a4 (patch)
tree063eb7a6ac469c6e1c8354f1be96a2503b697f7c /Alc/effects/equalizer.c
parentedcdc1dae85246b8ae633d112cfd7dda93fdc8c9 (diff)
Add a method to copy a filter's coefficients
Diffstat (limited to 'Alc/effects/equalizer.c')
-rw-r--r--Alc/effects/equalizer.c32
1 files changed, 4 insertions, 28 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)