aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/effects/equalizer.c32
-rw-r--r--Alc/effects/reverb.c13
-rw-r--r--OpenAL32/Include/alFilter.h9
-rw-r--r--OpenAL32/alFilter.c1
4 files changed, 16 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. */
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index 019e40d3..227d50cf 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -77,6 +77,15 @@ inline void ALfilterState_clear(ALfilterState *filter)
void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ);
+inline void ALfilterState_copyParams(ALfilterState *restrict dst, const ALfilterState *restrict src)
+{
+ dst->b0 = src->b0;
+ dst->b1 = src->b1;
+ dst->b2 = src->b2;
+ dst->a1 = src->a1;
+ dst->a2 = src->a2;
+}
+
void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples);
inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALsizei numsamples)
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index 855a7c6b..2a2b9621 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -36,6 +36,7 @@ extern inline void UnlockFiltersWrite(ALCdevice *device);
extern inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id);
extern inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id);
extern inline void ALfilterState_clear(ALfilterState *filter);
+extern inline void ALfilterState_copyParams(ALfilterState *restrict dst, const ALfilterState *restrict src);
extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALsizei numsamples);
extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope);
extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth);