From 764ea95781486f86c7be956e84cf97ab893ac07b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 3 Oct 2013 05:02:16 -0700 Subject: Use helpers to set channel gain arrays Also avoid unnecessary clearing. --- Alc/effects/autowah.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'Alc/effects/autowah.c') diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index cc207858..e0556cf3 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -80,16 +80,12 @@ static ALboolean ALautowahState_deviceUpdate(ALautowahState *state, ALCdevice *d static ALvoid ALautowahState_update(ALautowahState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALuint i; - ALfloat gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; - - /* computing high-pass cutoff and bandwidth */ const ALfloat cutoff = LOWPASSFREQREF / (Device->Frequency * 4.0f); const ALfloat bandwidth = (cutoff / 2.0f) / (cutoff * 0.67f); + ALfloat gain; /* computing high-pass filter coefficients */ - ALfilterState_setParams(&state->high_pass, - ALfilterType_HighPass, 1.0f, + ALfilterState_setParams(&state->high_pass, ALfilterType_HighPass, 1.0f, cutoff, bandwidth); state->AttackTime = Slot->EffectProps.Autowah.AttackTime; @@ -102,13 +98,8 @@ static ALvoid ALautowahState_update(ALautowahState *state, ALCdevice *Device, co ALfilterState_clear(&state->low_pass); - for(i = 0;i < MaxChannels;i++) - state->Gain[i] = 0.0f; - for(i = 0;i < Device->NumChan;i++) - { - enum Channel chan = Device->Speaker2Chan[i]; - state->Gain[chan] = gain; - } + gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; + SetGains(Device, gain, state->Gain); } static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE]) -- cgit v1.2.3