From 733cd120b35d14f36ec82fd87df9b26b35da2da1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 1 Jan 2008 06:16:19 -0800 Subject: [PATCH] Fix channel ordering for multichannel buffers --- Alc/ALu.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index c35b050f..cb79ee56 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -607,28 +607,6 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma if(Channels >= 4) { int i = 2; - if(Channels >= 7) - { - //First order interpolator (side left) - value = (ALfloat)((ALshort)(((Data[k*Channels+2]*((1L<>FRACTIONBITS)); - DryBuffer[j][SIDE_LEFT] += value*DrySend[SIDE_LEFT]; - WetBuffer[j][SIDE_LEFT] += value*WetSend[SIDE_LEFT]; - //First order interpolator (side right) - value = (ALfloat)((ALshort)(((Data[k*Channels+3]*((1L<>FRACTIONBITS)); - DryBuffer[j][SIDE_RIGHT] += value*DrySend[SIDE_RIGHT]; - WetBuffer[j][SIDE_RIGHT] += value*WetSend[SIDE_RIGHT]; - i += 2; - } - //First order interpolator (back left) - value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<>FRACTIONBITS)); - DryBuffer[j][BACK_LEFT] += value*DrySend[BACK_LEFT]; - WetBuffer[j][BACK_LEFT] += value*WetSend[BACK_LEFT]; - i++; - //First order interpolator (back right) - value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<>FRACTIONBITS)); - DryBuffer[j][BACK_RIGHT] += value*DrySend[BACK_RIGHT]; - WetBuffer[j][BACK_RIGHT] += value*WetSend[BACK_RIGHT]; - i++; if(Channels >= 6) { if(Channels != 7) @@ -643,6 +621,30 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<>FRACTIONBITS)); DryBuffer[j][LFE] += value*DrySend[LFE]; WetBuffer[j][LFE] += value*WetSend[LFE]; + i++; + } + //First order interpolator (back left) + value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<>FRACTIONBITS)); + DryBuffer[j][BACK_LEFT] += value*DrySend[BACK_LEFT]; + WetBuffer[j][BACK_LEFT] += value*WetSend[BACK_LEFT]; + i++; + //First order interpolator (back right) + value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<>FRACTIONBITS)); + DryBuffer[j][BACK_RIGHT] += value*DrySend[BACK_RIGHT]; + WetBuffer[j][BACK_RIGHT] += value*WetSend[BACK_RIGHT]; + i++; + if(Channels >= 7) + { + //First order interpolator (side left) + value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<>FRACTIONBITS)); + DryBuffer[j][SIDE_LEFT] += value*DrySend[SIDE_LEFT]; + WetBuffer[j][SIDE_LEFT] += value*WetSend[SIDE_LEFT]; + i++; + //First order interpolator (side right) + value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<>FRACTIONBITS)); + DryBuffer[j][SIDE_RIGHT] += value*DrySend[SIDE_RIGHT]; + WetBuffer[j][SIDE_RIGHT] += value*WetSend[SIDE_RIGHT]; + i++; } } }