diff options
author | Chris Robinson <[email protected]> | 2009-12-21 02:27:25 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-12-21 02:27:25 -0800 |
commit | d786f990940456eeb74bbe235756179a48912adf (patch) | |
tree | 6bdc55333b194128466fd4be0715bf8e5de40937 | |
parent | 008563450cccc253e2d2d6e3009e93f7f4303da9 (diff) |
Scale samples down when converting stereo to mono
-rw-r--r-- | Alc/ALu.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1251,6 +1251,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) ALuint SamplesToDo; ALeffectslot *ALEffectSlot; ALCcontext *ALContext; + ALfloat scalar; int fpuState; ALuint i, c; @@ -1302,10 +1303,12 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) { #define CHECK_WRITE_FORMAT(bits, type, func) \ case AL_FORMAT_MONO##bits: \ + scalar = aluSqrt(0.5); \ for(i = 0;i < SamplesToDo;i++) \ { \ - ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]] + \ - DryBuffer[i][ChanMap[1]]); \ + ((type*)buffer)[0] = (func)((DryBuffer[i][ChanMap[0]] + \ + DryBuffer[i][ChanMap[1]]) * \ + scalar); \ buffer = ((type*)buffer) + 1; \ } \ break; \ |