diff options
author | Chris Robinson <[email protected]> | 2012-04-28 08:24:09 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-04-28 08:24:09 -0700 |
commit | c34d78f41718f859709700b06bdfdf6640890275 (patch) | |
tree | 92e99f74a80855d3f06ad16388be8f30ec482371 /Alc/alcEcho.c | |
parent | 611bd0b2d3b40f306f120de5bb5d7edeccb0d32e (diff) |
Use ComputeAngleGains for the echo and dedicated effects
Diffstat (limited to 'Alc/alcEcho.c')
-rw-r--r-- | Alc/alcEcho.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c index 2448397c..711b763c 100644 --- a/Alc/alcEcho.c +++ b/Alc/alcEcho.c @@ -94,10 +94,9 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffec { ALechoState *state = (ALechoState*)effect; ALuint frequency = Device->Frequency; - ALfloat dirGain, ambientGain; - const ALfloat *ChannelGain; ALfloat lrpan, cw, g, gain; - ALuint i, pos; + ALfloat dirGain; + ALuint i; state->Tap[0].delay = fastf2u(Slot->effect.Echo.Delay * frequency) + 1; state->Tap[1].delay = fastf2u(Slot->effect.Echo.LRDelay * frequency); @@ -118,28 +117,13 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffec state->Gain[1][i] = 0.0f; } - ambientGain = aluSqrt(1.0f/Device->NumChan); dirGain = aluFabs(lrpan); /* First tap panning */ - pos = aluCart2LUTpos(((lrpan>0.0f)?-1.0f:1.0f), 0.0f); - ChannelGain = Device->PanningLUT[pos]; - - for(i = 0;i < Device->NumChan;i++) - { - enum Channel chan = Device->Speaker2Chan[i]; - state->Gain[0][chan] = lerp(ambientGain, ChannelGain[chan], dirGain) * gain; - } + ComputeAngleGains(Device, aluAtan2(-lrpan, 0.0f), (1.0f-dirGain)*F_PI, gain, state->Gain[0]); /* Second tap panning */ - pos = aluCart2LUTpos(((lrpan>0.0f)?1.0f:-1.0f), 0.0f); - ChannelGain = Device->PanningLUT[pos]; - - for(i = 0;i < Device->NumChan;i++) - { - enum Channel chan = Device->Speaker2Chan[i]; - state->Gain[1][chan] = lerp(ambientGain, ChannelGain[chan], dirGain) * gain; - } + ComputeAngleGains(Device, aluAtan2(+lrpan, 0.0f), (1.0f-dirGain)*F_PI, gain, state->Gain[1]); } static ALvoid EchoProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS]) |