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/ALu.c | |
parent | 3d1eb7dcadb7642320506bfc94a539f0afe25c9c (diff) |
Slightly improve channel gain calculations
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |