diff options
author | Chris Robinson <[email protected]> | 2011-05-01 18:18:37 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-05-01 18:18:37 -0700 |
commit | eea86ab8916c5e0213dabc404a191bbf0e0affbe (patch) | |
tree | 4755958ea83e6816039c90f1ed788f29a3245579 /Alc | |
parent | d7a452588cf9fc53c14712949c260e91799c6262 (diff) |
Use flags instead of separate bools
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 20 | ||||
-rw-r--r-- | Alc/ALu.c | 6 | ||||
-rw-r--r-- | Alc/mixer.c | 2 |
3 files changed, 15 insertions, 13 deletions
@@ -1186,11 +1186,12 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ProcessContext(context); } - device->UseHRTF = AL_FALSE; - if(ChannelsFromDevFmt(device->FmtChans) == 2 && device->Frequency == 44100) - device->UseHRTF = GetConfigValueBool(NULL, "hrtf", AL_FALSE); + device->Flags &= ~DEVICE_USE_HRTF; + if(ChannelsFromDevFmt(device->FmtChans) == 2 && device->Frequency == 44100 && + GetConfigValueBool(NULL, "hrtf", AL_FALSE)) + device->Flags |= DEVICE_USE_HRTF; - if(!device->UseHRTF && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) + if(!(device->Flags&DEVICE_USE_HRTF) && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) { if(!device->Bs2b) { @@ -1207,7 +1208,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } device->HeadDampen = 0.0f; - if(!device->UseHRTF && ChannelsFromDevFmt(device->FmtChans) <= 2) + if(!(device->Flags&DEVICE_USE_HRTF) && ChannelsFromDevFmt(device->FmtChans) <= 2) { device->HeadDampen = GetConfigValueFloat(NULL, "head_dampen", DEFAULT_HEAD_DAMPEN); device->HeadDampen = __min(device->HeadDampen, 1.0f); @@ -2282,7 +2283,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->IsLoopbackDevice = AL_FALSE; device->LastError = ALC_NO_ERROR; - device->UseHRTF = AL_FALSE; + device->Flags = 0; device->Bs2b = NULL; device->szDeviceName = NULL; @@ -2333,7 +2334,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->Bs2bLevel = GetConfigValueInt(NULL, "cf_level", 0); - device->DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 1); + if(GetConfigValueBool(NULL, "stereodup", AL_TRUE)) + device->Flags |= DEVICE_DUPLICATE_STEREO; device->HeadDampen = 0.0f; @@ -2472,6 +2474,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(void) device->IsLoopbackDevice = AL_TRUE; device->LastError = ALC_NO_ERROR; + device->Flags = 0; device->Bs2b = NULL; device->szDeviceName = NULL; @@ -2508,7 +2511,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(void) device->Bs2bLevel = GetConfigValueInt(NULL, "cf_level", 0); - device->DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 1); + if(GetConfigValueBool(NULL, "stereodup", AL_TRUE)) + device->Flags |= DEVICE_DUPLICATE_STEREO; device->HeadDampen = 0.0f; @@ -87,14 +87,12 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALfloat WetGain[MAX_SENDS]; ALfloat WetGainHF[MAX_SENDS]; ALint NumSends, Frequency; - ALboolean DupStereo; ALfloat Pitch; ALfloat cw; ALint i; /* Get device properties */ DevChans = ALContext->Device->FmtChans; - DupStereo = ALContext->Device->DuplicateStereo; NumSends = ALContext->Device->NumAuxSends; Frequency = ALContext->Device->Frequency; @@ -163,7 +161,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) SrcMatrix[0][FRONT_CENTER] = DryGain * ListenerGain; break; case FmtStereo: - if(DupStereo == AL_FALSE) + if(!(ALContext->Device->Flags&DEVICE_DUPLICATE_STEREO)) { SrcMatrix[0][FRONT_LEFT] = DryGain * ListenerGain; SrcMatrix[1][FRONT_RIGHT] = DryGain * ListenerGain; @@ -670,7 +668,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) Position[2] *= invlen; } - if(Device->UseHRTF) + if((Device->Flags&DEVICE_USE_HRTF)) { const ALshort *hrtf_left, *hrtf_right; diff --git a/Alc/mixer.c b/Alc/mixer.c index e1ecada8..f229b56a 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -566,7 +566,7 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ switch(FmtChannels) \ { \ case FmtMono: \ - if(Device->UseHRTF) \ + if((Device->Flags&DEVICE_USE_HRTF)) \ Mix_Hrtf_##T##_1_##sampler(Source, Device, Data, \ DataPosInt, DataPosFrac, \ OutPos, SamplesToDo, BufferSize); \ |