From d786f990940456eeb74bbe235756179a48912adf Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 21 Dec 2009 02:27:25 -0800 Subject: Scale samples down when converting stereo to mono --- Alc/ALu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index 9a6192f6..61218f22 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -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; \ -- cgit v1.2.3