aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-11-26 00:24:54 -0800
committerChris Robinson <[email protected]>2010-11-26 00:24:54 -0800
commit98d78f7ff9a3636567273e4384731debca2ec79f (patch)
tree00ac934d2223bd64d07467966d0c4c06ae548838 /Alc/ALu.c
parent3d1eb7dcadb7642320506bfc94a539f0afe25c9c (diff)
Slightly improve channel gain calculations
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 78f18782..b7471132 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -620,13 +620,13 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
DirGain = aluSqrt(Position[0]*Position[0] + Position[2]*Position[2]);
// elevation adjustment for directional gain. this sucks, but
// has low complexity
- AmbientGain = 1.0/aluSqrt(Device->NumChan) * (1.0-DirGain);
+ AmbientGain = aluSqrt(1.0/Device->NumChan);
for(s = 0;s < OUTPUTCHANNELS;s++)
ALSource->Params.DryGains[s] = 0.0f;
for(s = 0;s < (ALsizei)Device->NumChan;s++)
{
Channel chan = Device->Speaker2Chan[s];
- ALfloat gain = SpeakerGain[chan]*DirGain + AmbientGain;
+ ALfloat gain = AmbientGain + (SpeakerGain[chan]-AmbientGain)*DirGain;
ALSource->Params.DryGains[chan] = DryGain * gain;
}