From b4ffdfab81827626a3da2882218d401fd83cf375 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 6 Feb 2008 22:18:50 -0800 Subject: Add an option for duplicating stereo sources on the back speakers --- Alc/ALu.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index 79603425..756dce20 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -82,6 +82,8 @@ enum { OUTPUTCHANNELS }; +ALboolean DuplicateStereo = AL_FALSE; + /* NOTE: The AL_FORMAT_REAR* enums aren't handled here be cause they're * converted to AL_FORMAT_QUAD* when loaded */ __inline ALuint aluBytesFromFormat(ALenum format) @@ -752,14 +754,15 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma } else { + ALfloat samp1, samp2; //First order interpolator (front left) - value = (ALfloat)((ALshort)(((Data[k*Channels ]*((1L<>FRACTIONBITS)); - DryBuffer[j][FRONT_LEFT] += value*DrySend[FRONT_LEFT]; - WetBuffer[j][FRONT_LEFT] += value*WetSend[FRONT_LEFT]; + samp1 = (ALfloat)((ALshort)(((Data[k*Channels ]*((1L<>FRACTIONBITS)); + DryBuffer[j][FRONT_LEFT] += samp1*DrySend[FRONT_LEFT]; + WetBuffer[j][FRONT_LEFT] += samp1*WetSend[FRONT_LEFT]; //First order interpolator (front right) - value = (ALfloat)((ALshort)(((Data[k*Channels+1]*((1L<>FRACTIONBITS)); - DryBuffer[j][FRONT_RIGHT] += value*DrySend[FRONT_RIGHT]; - WetBuffer[j][FRONT_RIGHT] += value*WetSend[FRONT_RIGHT]; + samp2 = (ALfloat)((ALshort)(((Data[k*Channels+1]*((1L<>FRACTIONBITS)); + DryBuffer[j][FRONT_RIGHT] += samp2*DrySend[FRONT_RIGHT]; + WetBuffer[j][FRONT_RIGHT] += samp2*WetSend[FRONT_RIGHT]; if(Channels >= 4) { int i = 2; @@ -803,6 +806,14 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma i++; } } + else if(DuplicateStereo) + { + //Duplicate stereo channels on the back speakers + DryBuffer[j][BACK_LEFT] += samp1*DrySend[BACK_LEFT]; + WetBuffer[j][BACK_LEFT] += samp1*WetSend[BACK_LEFT]; + DryBuffer[j][BACK_RIGHT] += samp2*DrySend[BACK_RIGHT]; + WetBuffer[j][BACK_RIGHT] += samp2*WetSend[BACK_RIGHT]; + } } DataPosFrac += increment; j++; -- cgit v1.2.3