diff options
author | Chris Robinson <[email protected]> | 2015-07-06 12:37:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-07-06 12:37:21 -0700 |
commit | 8fa4f276f89985be44007ce166109837cbfd5763 (patch) | |
tree | b0342cbe526acea3e1cec4f121c53d57ab921b10 /Alc/ALc.c | |
parent | f58d985789f86ff11d1e2d1dda53801f447e2736 (diff) |
Allow specifying ALC_DONT_CARE_SOFT for ALC_HRTF_SOFT
ALC_FALSE now indicates explicitly no HRTF mixing, while ALC_DONT_CARE_SOFT
is autodetect.
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 39 |
1 files changed, 23 insertions, 16 deletions
@@ -1806,10 +1806,13 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(attrList[attrIdx] == ALC_HRTF_SOFT) { - if(attrList[attrIdx + 1] != ALC_FALSE) - flags |= DEVICE_HRTF_REQUEST; + flags &= ~DEVICE_HRTF_REQUEST_MASK; + if(attrList[attrIdx + 1] == ALC_FALSE) + flags |= Hrtf_Disable; + else if(attrList[attrIdx + 1] == ALC_TRUE) + flags |= Hrtf_Enable; else - flags &= ~DEVICE_HRTF_REQUEST; + flags |= Hrtf_Default; } attrIdx += 2; @@ -1875,10 +1878,13 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(attrList[attrIdx] == ALC_HRTF_SOFT) { - if(attrList[attrIdx + 1] != ALC_FALSE) - device->Flags |= DEVICE_HRTF_REQUEST; + device->Flags &= ~DEVICE_HRTF_REQUEST_MASK; + if(attrList[attrIdx + 1] == ALC_FALSE) + device->Flags |= Hrtf_Disable; + else if(attrList[attrIdx + 1] == ALC_TRUE) + device->Flags |= Hrtf_Enable; else - device->Flags &= ~DEVICE_HRTF_REQUEST; + device->Flags |= Hrtf_Default; } attrIdx += 2; @@ -1913,18 +1919,17 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) UpdateClockBase(device); device->Hrtf_Status = ALC_HRTF_DISABLED_SOFT; - if(device->Type != Loopback && ((device->Flags&DEVICE_HRTF_REQUEST) || GetConfigValueBool(NULL, "hrtf", 0))) + if(device->Type != Loopback && ((device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable || GetConfigValueBool(NULL, "hrtf", 0))) { if(!FindHrtfFormat(&device->FmtChans, &device->Frequency)) { - device->Flags &= ~DEVICE_HRTF_REQUEST; + device->Flags &= ~DEVICE_HRTF_REQUEST_MASK; device->Hrtf_Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; } else - device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_FREQUENCY_REQUEST | - DEVICE_HRTF_REQUEST; + device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_FREQUENCY_REQUEST; } - if(device->Type == Loopback && (device->Flags&DEVICE_HRTF_REQUEST)) + if(device->Type == Loopback && (device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable) { enum DevFmtChannels chans = device->FmtChans; ALCuint freq = device->Frequency; @@ -1932,7 +1937,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { ERR("Requested format not HRTF compatible: %s, %uhz\n", DevFmtChannelsString(device->FmtChans), device->Frequency); - device->Flags &= ~DEVICE_HRTF_REQUEST; + device->Flags &= ~DEVICE_HRTF_REQUEST_MASK; device->Hrtf_Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; } } @@ -2024,14 +2029,16 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(device->Type == Loopback || !ConfigValueBool(NULL, "hrtf", &usehrtf)) { - usehrtf = (headphones || (device->Flags&DEVICE_HRTF_REQUEST)); - if(headphones) + usehrtf = (headphones && (device->Flags&DEVICE_HRTF_REQUEST_MASK) != Hrtf_Disable) || + ((device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable); + if(headphones && (device->Flags&DEVICE_HRTF_REQUEST_MASK) != Hrtf_Disable) hrtf_status = ALC_HRTF_HEADPHONES_DETECTED_SOFT; else if(usehrtf) hrtf_status = ALC_HRTF_ENABLED_SOFT; } else { + device->Flags &= ~DEVICE_HRTF_REQUEST_MASK; if(!usehrtf) hrtf_status = ALC_HRTF_DENIED_SOFT; else @@ -2055,10 +2062,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } else { - device->Flags &= ~DEVICE_HRTF_REQUEST; TRACE("HRTF disabled\n"); - bs2blevel = (headphones ? 5 : 0); + bs2blevel = ((headphones && (device->Flags&DEVICE_HRTF_REQUEST_MASK) != Hrtf_Disable) || + ((device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable)) ? 5 : 0; if(device->Type != Loopback) ConfigValueInt(NULL, "cf_level", &bs2blevel); if(bs2blevel > 0 && bs2blevel <= 6) |