From a7d3779dfafbc7b5011ea7d1b252d94daed969f6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 6 Oct 2011 01:16:07 -0700 Subject: [PATCH] Check for the HRTF object instead of a flag --- Alc/ALc.c | 9 +++------ Alc/ALu.c | 8 ++++---- OpenAL32/Include/alMain.h | 6 ++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index 54821256..b548e6bf 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1155,14 +1155,11 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } device->Hrtf = NULL; - device->Flags &= ~DEVICE_USE_HRTF; if(!device->IsLoopbackDevice && GetConfigValueBool(NULL, "hrtf", AL_FALSE)) - device->Flags |= DEVICE_USE_HRTF; - if((device->Flags&DEVICE_USE_HRTF) && !(device->Hrtf=GetHrtf(device))) - device->Flags &= ~DEVICE_USE_HRTF; - TRACE("HRTF %s\n", (device->Flags&DEVICE_USE_HRTF)?"enabled":"disabled"); + device->Hrtf = GetHrtf(device); + TRACE("HRTF %s\n", device->Hrtf?"enabled":"disabled"); - if(!(device->Flags&DEVICE_USE_HRTF) && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) + if(!device->Hrtf && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) { if(!device->Bs2b) { diff --git a/Alc/ALu.c b/Alc/ALu.c index cb0eca6e..5dc2bc26 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -178,7 +178,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } BufferListItem = BufferListItem->next; } - if(ALSource->VirtualChannels && (Device->Flags&DEVICE_USE_HRTF)) + if(ALSource->VirtualChannels && Device->Hrtf) ALSource->Params.DoMix = SelectHrtfMixer((ALSource->Params.Step==FRACTIONONE) ? POINT_RESAMPLER : Resampler); else @@ -268,7 +268,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) for(c = 0;c < num_channels;c++) SrcMatrix[c][chans[c]] += DryGain * ListenerGain; } - else if((Device->Flags&DEVICE_USE_HRTF)) + else if(Device->Hrtf) { for(c = 0;c < num_channels;c++) { @@ -689,14 +689,14 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } BufferListItem = BufferListItem->next; } - if((Device->Flags&DEVICE_USE_HRTF)) + if(Device->Hrtf) ALSource->Params.DoMix = SelectHrtfMixer((ALSource->Params.Step==FRACTIONONE) ? POINT_RESAMPLER : Resampler); else ALSource->Params.DoMix = SelectMixer((ALSource->Params.Step==FRACTIONONE) ? POINT_RESAMPLER : Resampler); - if((Device->Flags&DEVICE_USE_HRTF)) + if(Device->Hrtf) { // Use a binaural HRTF algorithm for stereo headphone playback ALfloat delta, ev = 0.0f, az = 0.0f; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 3c47d024..a6ef8bb3 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -692,12 +692,10 @@ struct ALCdevice_struct // Duplicate stereo sources on the side/rear channels #define DEVICE_DUPLICATE_STEREO (1<<0) -// Use HRTF filters for mixing sounds -#define DEVICE_USE_HRTF (1<<1) // Frequency was requested by the app or config file -#define DEVICE_FREQUENCY_REQUEST (1<<2) +#define DEVICE_FREQUENCY_REQUEST (1<<1) // Channel configuration was requested by the config file -#define DEVICE_CHANNELS_REQUEST (1<<3) +#define DEVICE_CHANNELS_REQUEST (1<<2) // Specifies if the device is currently running #define DEVICE_RUNNING (1<<31) -- 2.11.4.GIT