diff options
author | Chris Robinson <[email protected]> | 2014-11-22 22:28:36 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-11-22 22:28:36 -0800 |
commit | 4f279557a6f9fa8102a18be26b0be44ccbb6e47e (patch) | |
tree | 28e6da1db9998eb777d67bfca1e4f57b6d8c28af | |
parent | ccbb3f069f03102627e0ef8ee34c9f6f2cf27161 (diff) |
Attempt to use BS2B when using headphones without HRTF
-rw-r--r-- | Alc/ALc.c | 43 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 1 |
2 files changed, 23 insertions, 21 deletions
@@ -1971,6 +1971,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { bool headphones = false; const char *mode; + int bs2blevel; int usehrtf; if(ConfigValueStr(NULL, "stereo-mode", &mode)) @@ -1988,26 +1989,32 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(usehrtf) device->Hrtf = GetHrtf(device->FmtChans, device->Frequency); - if(!device->Hrtf) + if(device->Hrtf) + TRACE("HRTF enabled\n"); + else + { device->Flags &= ~DEVICE_HRTF_REQUEST; - TRACE("HRTF %s\n", device->Hrtf?"enabled":"disabled"); + TRACE("HRTF disabled\n"); - if(!device->Hrtf && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) - { - if(!device->Bs2b) + bs2blevel = (headphones ? 5 : 0); + ConfigValueInt(NULL, "cf_level", &bs2blevel); + if(bs2blevel > 0 && bs2blevel <= 6) { - device->Bs2b = calloc(1, sizeof(*device->Bs2b)); - bs2b_clear(device->Bs2b); + if(!device->Bs2b) + { + device->Bs2b = calloc(1, sizeof(*device->Bs2b)); + bs2b_clear(device->Bs2b); + } + bs2b_set_srate(device->Bs2b, device->Frequency); + bs2b_set_level(device->Bs2b, bs2blevel); + TRACE("BS2B enabled\n"); + } + else + { + free(device->Bs2b); + device->Bs2b = NULL; + TRACE("BS2B disabled\n"); } - bs2b_set_srate(device->Bs2b, device->Frequency); - bs2b_set_level(device->Bs2b, device->Bs2bLevel); - TRACE("BS2B level %d\n", device->Bs2bLevel); - } - else - { - free(device->Bs2b); - device->Bs2b = NULL; - TRACE("BS2B disabled\n"); } } @@ -3253,7 +3260,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->Flags = 0; device->Bs2b = NULL; - device->Bs2bLevel = 0; AL_STRING_INIT(device->DeviceName); device->DryBuffer = NULL; @@ -3378,8 +3384,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) ConfigValueUInt(NULL, "sends", &device->NumAuxSends); if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS; - ConfigValueInt(NULL, "cf_level", &device->Bs2bLevel); - device->NumStereoSources = 1; device->NumMonoSources = device->MaxNoOfSources - device->NumStereoSources; @@ -3700,7 +3704,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN device->Flags = 0; device->Bs2b = NULL; - device->Bs2bLevel = 0; AL_STRING_INIT(device->DeviceName); device->DryBuffer = NULL; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 4cff96ae..56df4db3 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -686,7 +686,6 @@ struct ALCdevice_struct // Stereo-to-binaural filter struct bs2b *Bs2b; - ALCint Bs2bLevel; // Device flags ALuint Flags; |