diff options
author | Chris Robinson <[email protected]> | 2013-10-03 05:02:16 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-10-03 05:02:16 -0700 |
commit | 764ea95781486f86c7be956e84cf97ab893ac07b (patch) | |
tree | a6fc6b17121a2f4cab499b97a59378470fb3cb75 /Alc/effects/autowah.c | |
parent | 99fa5911bc9f427c96fe800f94d31e4942805fd2 (diff) |
Use helpers to set channel gain arrays
Also avoid unnecessary clearing.
Diffstat (limited to 'Alc/effects/autowah.c')
-rw-r--r-- | Alc/effects/autowah.c | 17 |
1 files changed, 4 insertions, 13 deletions
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])
|