summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-31 04:50:34 -0800
committerChris Robinson <[email protected]>2007-12-31 04:50:34 -0800
commitcb1d62f254a26f0bb1af545df9966312b08e1161 (patch)
tree98c8421eec86e1ab0d7608bc2160af1066b2381f
parent1cbd625b4e88a75deafbed3d30b7e7068ec819c0 (diff)
Add paths for 4 to 7.1 channel buffer mixing
-rw-r--r--Alc/ALu.c53
1 files changed, 45 insertions, 8 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index d62dd1b4..c35b050f 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -596,18 +596,55 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
}
else
{
- //First order interpolator (left)
- value = (ALfloat)((ALshort)(((Data[k*2 ]*((1L<<FRACTIONBITS)-fraction))+(Data[k*2+2]*(fraction)))>>FRACTIONBITS));
- //Direct path final mix buffer and panning (left)
+ //First order interpolator (front left)
+ value = (ALfloat)((ALshort)(((Data[k*Channels ]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels ]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][FRONT_LEFT] += value*DrySend[FRONT_LEFT];
- //Room path final mix buffer and panning (left)
WetBuffer[j][FRONT_LEFT] += value*WetSend[FRONT_LEFT];
- //First order interpolator (right)
- value = (ALfloat)((ALshort)(((Data[k*2+1]*((1L<<FRACTIONBITS)-fraction))+(Data[k*2+3]*(fraction)))>>FRACTIONBITS));
- //Direct path final mix buffer and panning (right)
+ //First order interpolator (front right)
+ value = (ALfloat)((ALshort)(((Data[k*Channels+1]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+1]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][FRONT_RIGHT] += value*DrySend[FRONT_RIGHT];
- //Room path final mix buffer and panning (right)
WetBuffer[j][FRONT_RIGHT] += value*WetSend[FRONT_RIGHT];
+ if(Channels >= 4)
+ {
+ int i = 2;
+ if(Channels >= 7)
+ {
+ //First order interpolator (side left)
+ value = (ALfloat)((ALshort)(((Data[k*Channels+2]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+2]*(fraction)))>>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)-fraction))+(Data[(k+1)*Channels+3]*(fraction)))>>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)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>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)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
+ DryBuffer[j][BACK_RIGHT] += value*DrySend[BACK_RIGHT];
+ WetBuffer[j][BACK_RIGHT] += value*WetSend[BACK_RIGHT];
+ i++;
+ if(Channels >= 6)
+ {
+ if(Channels != 7)
+ {
+ //First order interpolator (center)
+ value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
+ DryBuffer[j][CENTER] += value*DrySend[CENTER];
+ WetBuffer[j][CENTER] += value*WetSend[CENTER];
+ i++;
+ }
+ //First order interpolator (lfe)
+ value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
+ DryBuffer[j][LFE] += value*DrySend[LFE];
+ WetBuffer[j][LFE] += value*WetSend[LFE];
+ }
+ }
}
DataPosFrac += increment;
j++;