diff options
author | Chris Robinson <[email protected]> | 2022-02-08 08:33:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-02-08 08:33:01 -0800 |
commit | 98fc1cd97df227f12a1047c2b8385683b7f610fa (patch) | |
tree | 48348fb99a8d3a60270e93c616e0acf28ce249a7 /alc | |
parent | be80e49f1bb7e09dd67ea6886f19f091bde8a2d7 (diff) |
More accurately detect the EAX speaker config
Diffstat (limited to 'alc')
-rw-r--r-- | alc/context.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/alc/context.cpp b/alc/context.cpp index a1b2fc36..cf879d9c 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -723,18 +723,30 @@ unsigned long ALCcontext::eax_detect_speaker_configuration() const { #define EAX_PREFIX "[EAX_DETECT_SPEAKER_CONFIG]" - switch (mDevice->channelsFromFmt()) + switch(mDevice->FmtChans) { - case 2: return mDevice->Flags.test(DirectEar) ? HEADPHONES : SPEAKERS_2; - case 4: return SPEAKERS_4; - case 6: return SPEAKERS_5; - case 7: return SPEAKERS_6; - case 8: return SPEAKERS_7; - - default: - WARN(EAX_PREFIX "Unsupported device channel format %d.\n", mDevice->FmtChans); + case DevFmtMono: return SPEAKERS_2; + case DevFmtStereo: + /* Pretend 7.1 if using UHJ output, since they both provide full + * horizontal surround. + */ + if(mDevice->mUhjEncoder) + return SPEAKERS_7; + if(mDevice->Flags.test(DirectEar)) return HEADPHONES; + return SPEAKERS_2; + case DevFmtQuad: return SPEAKERS_4; + case DevFmtX51: return SPEAKERS_5; + case DevFmtX61: return SPEAKERS_6; + case DevFmtX71: return SPEAKERS_7; + /* This could also be HEADPHONES, since headphones-based HRTF and Ambi3D + * provide full-sphere surround sound. Depends if apps are more likely to + * consider headphones or 7.1 for surround sound support. + */ + case DevFmtAmbi3D: return SPEAKERS_7; } + ERR(EAX_PREFIX "Unexpected device channel format 0x%x.\n", mDevice->FmtChans); + return HEADPHONES; #undef EAX_PREFIX } |