aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/base.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-04-26 23:32:15 -0700
committerChris Robinson <[email protected]>2022-04-26 23:32:15 -0700
commit593966c8dbdbf2dbcd8768b258a3b22adb548b2f (patch)
tree720dd3a36188cdb1ff55165d1b2bd51e5fd7d687 /alc/backends/base.cpp
parent07dd62e53f3abaf918262953895961bd38848a7e (diff)
Handle 3D7.1 as a separate channel configuration
It's treated as 5.1 + 2 aux channels. This allows AL_DIRECT_CHANNELS_SOFT to behave better, not forwarding rear left/right channel inputs to lower front and upper rear, and allows reporting a more appropriate output mode to the app instead of 7.1.
Diffstat (limited to 'alc/backends/base.cpp')
-rw-r--r--alc/backends/base.cpp74
1 files changed, 20 insertions, 54 deletions
diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp
index cd1b76ba..4abd7c03 100644
--- a/alc/backends/base.cpp
+++ b/alc/backends/base.cpp
@@ -98,6 +98,16 @@ void BackendBase::setDefaultWFXChannelOrder()
mDevice->RealOut.ChannelIndex[SideLeft] = 6;
mDevice->RealOut.ChannelIndex[SideRight] = 7;
break;
+ case DevFmtX3D71:
+ mDevice->RealOut.ChannelIndex[FrontLeft] = 0;
+ mDevice->RealOut.ChannelIndex[FrontRight] = 1;
+ mDevice->RealOut.ChannelIndex[FrontCenter] = 2;
+ mDevice->RealOut.ChannelIndex[LFE] = 3;
+ mDevice->RealOut.ChannelIndex[Aux0] = 4;
+ mDevice->RealOut.ChannelIndex[Aux1] = 5;
+ mDevice->RealOut.ChannelIndex[SideLeft] = 6;
+ mDevice->RealOut.ChannelIndex[SideRight] = 7;
+ break;
case DevFmtAmbi3D:
break;
}
@@ -127,6 +137,16 @@ void BackendBase::setDefaultChannelOrder()
mDevice->RealOut.ChannelIndex[SideLeft] = 6;
mDevice->RealOut.ChannelIndex[SideRight] = 7;
return;
+ case DevFmtX3D71:
+ mDevice->RealOut.ChannelIndex[FrontLeft] = 0;
+ mDevice->RealOut.ChannelIndex[FrontRight] = 1;
+ mDevice->RealOut.ChannelIndex[Aux0] = 2;
+ mDevice->RealOut.ChannelIndex[Aux1] = 3;
+ mDevice->RealOut.ChannelIndex[FrontCenter] = 4;
+ mDevice->RealOut.ChannelIndex[LFE] = 5;
+ mDevice->RealOut.ChannelIndex[SideLeft] = 6;
+ mDevice->RealOut.ChannelIndex[SideRight] = 7;
+ return;
/* Same as WFX order */
case DevFmtMono:
@@ -138,57 +158,3 @@ void BackendBase::setDefaultChannelOrder()
break;
}
}
-
-#ifdef _WIN32
-void BackendBase::setChannelOrderFromWFXMask(uint chanmask)
-{
- static constexpr uint x51{SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER
- | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT};
- static constexpr uint x51rear{SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER
- | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT};
- /* Swap a 5.1 mask using the back channels for one with the sides. */
- if(chanmask == x51rear) chanmask = x51;
-
- auto get_channel = [](const DWORD chanbit) noexcept -> al::optional<Channel>
- {
- switch(chanbit)
- {
- case SPEAKER_FRONT_LEFT: return al::make_optional(FrontLeft);
- case SPEAKER_FRONT_RIGHT: return al::make_optional(FrontRight);
- case SPEAKER_FRONT_CENTER: return al::make_optional(FrontCenter);
- case SPEAKER_LOW_FREQUENCY: return al::make_optional(LFE);
- case SPEAKER_BACK_LEFT: return al::make_optional(BackLeft);
- case SPEAKER_BACK_RIGHT: return al::make_optional(BackRight);
- case SPEAKER_FRONT_LEFT_OF_CENTER: break;
- case SPEAKER_FRONT_RIGHT_OF_CENTER: break;
- case SPEAKER_BACK_CENTER: return al::make_optional(BackCenter);
- case SPEAKER_SIDE_LEFT: return al::make_optional(SideLeft);
- case SPEAKER_SIDE_RIGHT: return al::make_optional(SideRight);
- case SPEAKER_TOP_CENTER: return al::make_optional(TopCenter);
- case SPEAKER_TOP_FRONT_LEFT: return al::make_optional(TopFrontLeft);
- case SPEAKER_TOP_FRONT_CENTER: return al::make_optional(TopFrontCenter);
- case SPEAKER_TOP_FRONT_RIGHT: return al::make_optional(TopFrontRight);
- case SPEAKER_TOP_BACK_LEFT: return al::make_optional(TopBackLeft);
- case SPEAKER_TOP_BACK_CENTER: return al::make_optional(TopBackCenter);
- case SPEAKER_TOP_BACK_RIGHT: return al::make_optional(TopBackRight);
- }
- WARN("Unhandled WFX channel bit 0x%lx\n", chanbit);
- return al::nullopt;
- };
-
- const uint numchans{mDevice->channelsFromFmt()};
- uint idx{0};
- while(chanmask)
- {
- const int bit{al::countr_zero(chanmask)};
- const uint mask{1u << bit};
- chanmask &= ~mask;
-
- if(auto label = get_channel(mask))
- {
- mDevice->RealOut.ChannelIndex[*label] = idx;
- if(++idx == numchans) break;
- }
- }
-}
-#endif