diff options
author | Chris Robinson <[email protected]> | 2010-04-20 03:57:40 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-04-20 03:57:40 -0700 |
commit | a04dac670ed89aabe05cdfd45649bb4c85b90bda (patch) | |
tree | 8c10998cbda049b4e87fc23350edbaf95c2a766c | |
parent | 81dd71dd71aa1b11d3304265acd0728659465ab1 (diff) |
Make stereo duplication a property of the device
Further, don't use it with mono/stereo output
-rw-r--r-- | Alc/ALc.c | 2 | ||||
-rw-r--r-- | Alc/ALu.c | 10 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 2 |
4 files changed, 11 insertions, 6 deletions
@@ -337,8 +337,6 @@ static void alc_init(void) for(i = 0;BackendList[i].Init;i++) BackendList[i].Init(&BackendList[i].Funcs); - DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 0); - str = GetConfigValue(NULL, "excludefx", ""); if(str[0]) { @@ -45,8 +45,6 @@ * adequately reduce clicks and pops from harsh gain changes. */ #define MIN_RAMP_LENGTH 16 -ALboolean DuplicateStereo = AL_FALSE; - static __inline ALfloat aluF2F(ALfloat Value) { @@ -250,6 +248,7 @@ ALvoid aluInitPanning(ALCdevice *Device) case AL_FORMAT_MONO8: case AL_FORMAT_MONO16: case AL_FORMAT_MONO_FLOAT32: + Device->DuplicateStereo = AL_FALSE; Device->ChannelMatrix[FRONT_LEFT][FRONT_CENTER] = aluSqrt(0.5); Device->ChannelMatrix[FRONT_RIGHT][FRONT_CENTER] = aluSqrt(0.5); Device->ChannelMatrix[SIDE_LEFT][FRONT_CENTER] = aluSqrt(0.5); @@ -265,6 +264,7 @@ ALvoid aluInitPanning(ALCdevice *Device) case AL_FORMAT_STEREO8: case AL_FORMAT_STEREO16: case AL_FORMAT_STEREO_FLOAT32: + Device->DuplicateStereo = AL_FALSE; Device->ChannelMatrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5); Device->ChannelMatrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5); Device->ChannelMatrix[SIDE_LEFT][FRONT_LEFT] = 1.0f; @@ -284,6 +284,7 @@ ALvoid aluInitPanning(ALCdevice *Device) case AL_FORMAT_QUAD8: case AL_FORMAT_QUAD16: case AL_FORMAT_QUAD32: + Device->DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 0); Device->ChannelMatrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5); Device->ChannelMatrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5); Device->ChannelMatrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(0.5); @@ -307,6 +308,7 @@ ALvoid aluInitPanning(ALCdevice *Device) case AL_FORMAT_51CHN8: case AL_FORMAT_51CHN16: case AL_FORMAT_51CHN32: + Device->DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 0); Device->ChannelMatrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(0.5); Device->ChannelMatrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(0.5); Device->ChannelMatrix[SIDE_RIGHT][FRONT_RIGHT] = aluSqrt(0.5); @@ -330,6 +332,7 @@ ALvoid aluInitPanning(ALCdevice *Device) case AL_FORMAT_61CHN8: case AL_FORMAT_61CHN16: case AL_FORMAT_61CHN32: + Device->DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 0); Device->ChannelMatrix[BACK_LEFT][BACK_CENTER] = aluSqrt(0.5); Device->ChannelMatrix[BACK_LEFT][SIDE_LEFT] = aluSqrt(0.5); Device->ChannelMatrix[BACK_RIGHT][BACK_CENTER] = aluSqrt(0.5); @@ -353,6 +356,7 @@ ALvoid aluInitPanning(ALCdevice *Device) case AL_FORMAT_71CHN8: case AL_FORMAT_71CHN16: case AL_FORMAT_71CHN32: + Device->DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 0); Device->ChannelMatrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5); Device->ChannelMatrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5); Device->NumChan = 7; @@ -923,6 +927,7 @@ static void MixSomeSources(ALCcontext *ALContext, float (*DryBuffer)[OUTPUTCHANN FILTER *DryFilter, *WetFilter[MAX_SENDS]; ALfloat WetSend[MAX_SENDS]; ALuint rampLength; + ALboolean DuplicateStereo; ALuint DeviceFreq; ALint increment; ALuint DataPosInt, DataPosFrac; @@ -936,6 +941,7 @@ static void MixSomeSources(ALCcontext *ALContext, float (*DryBuffer)[OUTPUTCHANN if(!(ALSource=ALContext->SourceList)) return; + DuplicateStereo = ALContext->Device->DuplicateStereo; DeviceFreq = ALContext->Device->Frequency; rampLength = DeviceFreq * MIN_RAMP_LENGTH / 1000; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index c7f4bd72..992ccfec 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -272,6 +272,9 @@ struct ALCdevice_struct // Simulated dampening from head occlusion ALfloat HeadDampen; + // Duplicate stereo sources on the side/rear channels + ALboolean DuplicateStereo; + // Dry path buffer mix float DryBuffer[BUFFERSIZE][OUTPUTCHANNELS]; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 32b411d5..62b6fbe7 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -76,8 +76,6 @@ typedef enum { #define BUFFERSIZE 16384 -extern ALboolean DuplicateStereo; - /* NOTE: The AL_FORMAT_REAR* enums aren't handled here be cause they're * converted to AL_FORMAT_QUAD* when loaded */ static __inline ALuint aluBytesFromFormat(ALenum format) |