aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-12-21 02:27:25 -0800
committerChris Robinson <[email protected]>2009-12-21 02:27:25 -0800
commitd786f990940456eeb74bbe235756179a48912adf (patch)
tree6bdc55333b194128466fd4be0715bf8e5de40937 /Alc
parent008563450cccc253e2d2d6e3009e93f7f4303da9 (diff)
Scale samples down when converting stereo to mono
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c7
1 files changed, 5 insertions, 2 deletions
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; \