diff options
author | Chris Robinson <[email protected]> | 2021-07-31 14:24:49 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-07-31 14:24:49 -0700 |
commit | 0a0849db997df2015223bfd43cb7490fc8cd601e (patch) | |
tree | d5ea8c1e3bf0d905e9ec36d43ab0ad5a96fb68f4 /alc/alc.cpp | |
parent | 440b59704c82684786bf7e251b4882f2a12c4c06 (diff) |
Use an optional bool instead of two tri-state enums
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 21c95cbd..8c09e474 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1514,10 +1514,9 @@ static inline void UpdateClockBase(ALCdevice *device) */ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) { - HrtfRequestMode hrtf_userreq{Hrtf_Default}; - HrtfRequestMode hrtf_appreq{Hrtf_Default}; ALCenum gainLimiter{device->LimiterState}; uint new_sends{device->NumAuxSends}; + al::optional<bool> hrtfreq{}; DevFmtChannels oldChans; DevFmtType oldType; int hrtf_id{-1}; @@ -1602,11 +1601,11 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) case ALC_HRTF_SOFT: TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); if(attrList[attrIdx + 1] == ALC_FALSE) - hrtf_appreq = Hrtf_Disable; + hrtfreq = al::make_optional(false); else if(attrList[attrIdx + 1] == ALC_TRUE) - hrtf_appreq = Hrtf_Enable; + hrtfreq = al::make_optional(true); else - hrtf_appreq = Hrtf_Default; + hrtfreq = al::nullopt; break; case ALC_HRTF_ID_SOFT: @@ -1761,14 +1760,15 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) { const char *hrtf{hrtfopt->c_str()}; if(al::strcasecmp(hrtf, "true") == 0) - hrtf_userreq = Hrtf_Enable; + hrtfreq = al::make_optional(true); else if(al::strcasecmp(hrtf, "false") == 0) - hrtf_userreq = Hrtf_Disable; + hrtfreq = al::make_optional(false); else if(al::strcasecmp(hrtf, "auto") != 0) ERR("Unexpected hrtf value: %s\n", hrtf); } - if(hrtf_userreq == Hrtf_Enable || (hrtf_userreq != Hrtf_Disable && hrtf_appreq == Hrtf_Enable)) + /* If the app or user wants HRTF, try to set stereo playback. */ + if(hrtfreq && hrtfreq.value()) { device->FmtChans = DevFmtStereo; device->Flags.set(ChannelsRequest); @@ -1829,7 +1829,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) case DevFmtAmbi3D: break; } - aluInitRenderer(device, hrtf_id, hrtf_appreq, hrtf_userreq); + aluInitRenderer(device, hrtf_id, hrtfreq); device->NumAuxSends = new_sends; TRACE("Max sources: %d (%d + %d), effect slots: %d, sends: %d\n", |