diff options
author | Chris Robinson <[email protected]> | 2010-11-26 00:24:54 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-26 00:24:54 -0800 |
commit | 98d78f7ff9a3636567273e4384731debca2ec79f (patch) | |
tree | 00ac934d2223bd64d07467966d0c4c06ae548838 /Alc/alcReverb.c | |
parent | 3d1eb7dcadb7642320506bfc94a539f0afe25c9c (diff) |
Slightly improve channel gain calculations
Diffstat (limited to 'Alc/alcReverb.c')
-rw-r--r-- | Alc/alcReverb.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index e1f6df45..02f07f9a 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -596,7 +596,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection ALfloat latePan[3] = { LateReverbPan[0], LateReverbPan[1], LateReverbPan[2] }; const ALfloat *speakerGain; - ALfloat dirGain, ambientGain; + ALfloat dirGain; ALfloat length; ALuint index; ALint pos; @@ -629,27 +629,26 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection pos = aluCart2LUTpos(earlyPan[2], earlyPan[0]); speakerGain = &Device->PanningLUT[OUTPUTCHANNELS * pos]; dirGain = aluSqrt((earlyPan[0] * earlyPan[0]) + (earlyPan[2] * earlyPan[2])); - ambientGain = (1.0 - dirGain); + for(index = 0;index < OUTPUTCHANNELS;index++) State->Early.PanGain[index] = 0.0f; for(index = 0;index < Device->NumChan;index++) { Channel chan = Device->Speaker2Chan[index]; - State->Early.PanGain[chan] = speakerGain[chan]*dirGain + - ambientGain; + State->Early.PanGain[chan] = 1.0 + (speakerGain[chan]-1.0)*dirGain; } + pos = aluCart2LUTpos(latePan[2], latePan[0]); speakerGain = &Device->PanningLUT[OUTPUTCHANNELS * pos]; dirGain = aluSqrt((latePan[0] * latePan[0]) + (latePan[2] * latePan[2])); - ambientGain = (1.0 - dirGain); + for(index = 0;index < OUTPUTCHANNELS;index++) State->Late.PanGain[index] = 0.0f; for(index = 0;index < Device->NumChan;index++) { Channel chan = Device->Speaker2Chan[index]; - State->Late.PanGain[chan] = speakerGain[chan]*dirGain + - ambientGain; + State->Late.PanGain[chan] = 1.0 + (speakerGain[chan]-1.0)*dirGain; } } |