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/distortion.c | |
parent | 99fa5911bc9f427c96fe800f94d31e4942805fd2 (diff) |
Use helpers to set channel gain arrays
Also avoid unnecessary clearing.
Diffstat (limited to 'Alc/effects/distortion.c')
-rw-r--r-- | Alc/effects/distortion.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index dce0d64d..768d1ee2 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -64,20 +64,11 @@ static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *state, ALCdev static ALvoid ALdistortionState_update(ALdistortionState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALfloat gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; ALfloat frequency = (ALfloat)Device->Frequency; - ALuint it; ALfloat bandwidth; ALfloat cutoff; ALfloat edge; - - for(it = 0;it < MaxChannels;it++) - state->Gain[it] = 0.0f; - for(it = 0;it < Device->NumChan;it++) - { - enum Channel chan = Device->Speaker2Chan[it]; - state->Gain[chan] = gain; - } + ALfloat gain; /* Store distorted signal attenuation settings */ state->attenuation = Slot->EffectProps.Distortion.Gain; @@ -100,6 +91,9 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, ALCdevice *Devi bandwidth = Slot->EffectProps.Distortion.EQBandwidth / (cutoff * 0.67f); ALfilterState_setParams(&state->bandpass, ALfilterType_BandPass, 1.0f, cutoff / (frequency*4.0f), bandwidth); + + gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; + SetGains(Device, gain, state->Gain); } static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) |