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/reverb.c | |
parent | 99fa5911bc9f427c96fe800f94d31e4942805fd2 (diff) |
Use helpers to set channel gain arrays
Also avoid unnecessary clearing.
Diffstat (limited to 'Alc/effects/reverb.c')
-rw-r--r-- | Alc/effects/reverb.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 5758a09e..261a1f7f 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -1044,7 +1044,6 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection ALfloat ambientGain; ALfloat dirGain; ALfloat length; - ALuint index; Gain *= ReverbBoost; @@ -1070,14 +1069,10 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection } dirGain = sqrtf(earlyPan[0]*earlyPan[0] + earlyPan[2]*earlyPan[2]); - for(index = 0;index < MaxChannels;index++) - State->Early.PanGain[index] = 0.0f; ComputeAngleGains(Device, atan2f(earlyPan[0], earlyPan[2]), (1.0f-dirGain)*F_PI, lerp(ambientGain, 1.0f, dirGain) * Gain, State->Early.PanGain); dirGain = sqrtf(latePan[0]*latePan[0] + latePan[2]*latePan[2]); - for(index = 0;index < MaxChannels;index++) - State->Late.PanGain[index] = 0.0f; ComputeAngleGains(Device, atan2f(latePan[0], latePan[2]), (1.0f-dirGain)*F_PI, lerp(ambientGain, 1.0f, dirGain) * Gain, State->Late.PanGain); } @@ -1168,18 +1163,9 @@ static ALvoid ALreverbState_update(ALreverbState *State, ALCdevice *Device, cons } else { - ALfloat gain = Slot->Gain; - ALuint index; - /* Update channel gains */ - gain *= sqrtf(2.0f/Device->NumChan) * ReverbBoost; - for(index = 0;index < MaxChannels;index++) - State->Gain[index] = 0.0f; - for(index = 0;index < Device->NumChan;index++) - { - enum Channel chan = Device->Speaker2Chan[index]; - State->Gain[chan] = gain; - } + ALfloat gain = sqrtf(2.0f/Device->NumChan) * ReverbBoost * Slot->Gain; + SetGains(Device, gain, State->Gain); } } |