aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends')
-rw-r--r--alc/backends/base.cpp22
-rw-r--r--alc/backends/coreaudio.cpp1
-rw-r--r--alc/backends/dsound.cpp6
-rw-r--r--alc/backends/oboe.cpp36
-rw-r--r--alc/backends/opensl.cpp3
-rw-r--r--alc/backends/pulseaudio.cpp8
-rw-r--r--alc/backends/wasapi.cpp19
-rw-r--r--alc/backends/wave.cpp1
-rw-r--r--alc/backends/winmm.cpp1
9 files changed, 22 insertions, 75 deletions
diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp
index 0c28d238..dea29a80 100644
--- a/alc/backends/base.cpp
+++ b/alc/backends/base.cpp
@@ -79,14 +79,6 @@ void BackendBase::setDefaultWFXChannelOrder()
mDevice->RealOut.ChannelIndex[SideLeft] = 4;
mDevice->RealOut.ChannelIndex[SideRight] = 5;
break;
- case DevFmtX51Rear:
- mDevice->RealOut.ChannelIndex[FrontLeft] = 0;
- mDevice->RealOut.ChannelIndex[FrontRight] = 1;
- mDevice->RealOut.ChannelIndex[FrontCenter] = 2;
- mDevice->RealOut.ChannelIndex[LFE] = 3;
- mDevice->RealOut.ChannelIndex[BackLeft] = 4;
- mDevice->RealOut.ChannelIndex[BackRight] = 5;
- break;
case DevFmtX61:
mDevice->RealOut.ChannelIndex[FrontLeft] = 0;
mDevice->RealOut.ChannelIndex[FrontRight] = 1;
@@ -117,11 +109,11 @@ void BackendBase::setDefaultChannelOrder()
switch(mDevice->FmtChans)
{
- case DevFmtX51Rear:
+ case DevFmtX51:
mDevice->RealOut.ChannelIndex[FrontLeft] = 0;
mDevice->RealOut.ChannelIndex[FrontRight] = 1;
- mDevice->RealOut.ChannelIndex[BackLeft] = 2;
- mDevice->RealOut.ChannelIndex[BackRight] = 3;
+ mDevice->RealOut.ChannelIndex[SideLeft] = 2;
+ mDevice->RealOut.ChannelIndex[SideRight] = 3;
mDevice->RealOut.ChannelIndex[FrontCenter] = 4;
mDevice->RealOut.ChannelIndex[LFE] = 5;
return;
@@ -140,7 +132,6 @@ void BackendBase::setDefaultChannelOrder()
case DevFmtMono:
case DevFmtStereo:
case DevFmtQuad:
- case DevFmtX51:
case DevFmtX61:
case DevFmtAmbi3D:
setDefaultWFXChannelOrder();
@@ -151,6 +142,13 @@ void BackendBase::setDefaultChannelOrder()
#ifdef _WIN32
void BackendBase::setChannelOrderFromWFXMask(uint chanmask)
{
+ constexpr uint x51{SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER
+ | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT};
+ 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)
diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp
index b41b7d00..1111b340 100644
--- a/alc/backends/coreaudio.cpp
+++ b/alc/backends/coreaudio.cpp
@@ -760,7 +760,6 @@ void CoreAudioCapture::open(const char *name)
case DevFmtQuad:
case DevFmtX51:
- case DevFmtX51Rear:
case DevFmtX61:
case DevFmtX71:
case DevFmtAmbi3D:
diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp
index 401f8165..6513e8f3 100644
--- a/alc/backends/dsound.cpp
+++ b/alc/backends/dsound.cpp
@@ -402,10 +402,8 @@ bool DSoundPlayback::reset()
mDevice->FmtChans = DevFmtStereo;
else if(speakers == DSSPEAKER_QUAD)
mDevice->FmtChans = DevFmtQuad;
- else if(speakers == DSSPEAKER_5POINT1_SURROUND)
+ else if(speakers == DSSPEAKER_5POINT1_SURROUND || speakers == DSSPEAKER_5POINT1_BACK)
mDevice->FmtChans = DevFmtX51;
- else if(speakers == DSSPEAKER_5POINT1_BACK)
- mDevice->FmtChans = DevFmtX51Rear;
else if(speakers == DSSPEAKER_7POINT1 || speakers == DSSPEAKER_7POINT1_SURROUND)
mDevice->FmtChans = DevFmtX71;
else
@@ -422,7 +420,6 @@ bool DSoundPlayback::reset()
case DevFmtStereo: OutputType.dwChannelMask = STEREO; break;
case DevFmtQuad: OutputType.dwChannelMask = QUAD; break;
case DevFmtX51: OutputType.dwChannelMask = X5DOT1; break;
- case DevFmtX51Rear: OutputType.dwChannelMask = X5DOT1REAR; break;
case DevFmtX61: OutputType.dwChannelMask = X6DOT1; break;
case DevFmtX71: OutputType.dwChannelMask = X7DOT1; break;
}
@@ -639,7 +636,6 @@ void DSoundCapture::open(const char *name)
case DevFmtStereo: InputType.dwChannelMask = STEREO; break;
case DevFmtQuad: InputType.dwChannelMask = QUAD; break;
case DevFmtX51: InputType.dwChannelMask = X5DOT1; break;
- case DevFmtX51Rear: InputType.dwChannelMask = X5DOT1REAR; break;
case DevFmtX61: InputType.dwChannelMask = X6DOT1; break;
case DevFmtX71: InputType.dwChannelMask = X7DOT1; break;
case DevFmtAmbi3D:
diff --git a/alc/backends/oboe.cpp b/alc/backends/oboe.cpp
index ddc3f0b9..aefda974 100644
--- a/alc/backends/oboe.cpp
+++ b/alc/backends/oboe.cpp
@@ -131,38 +131,15 @@ bool OboePlayback::reset()
mStream->getBufferCapacityInFrames()));
TRACE("Got stream with properties:\n%s", oboe::convertToText(mStream.get()));
- switch(mStream->getChannelCount())
+ if(static_cast<uint>(mStream->getChannelCount()) != mDevice->channelsFromFmt())
{
- case oboe::ChannelCount::Mono:
- mDevice->FmtChans = DevFmtMono;
- break;
- case oboe::ChannelCount::Stereo:
- mDevice->FmtChans = DevFmtStereo;
- break;
- /* Other potential configurations. Could be wrong, but better than failing.
- * Assume WFX channel order.
- */
- case 4:
- mDevice->FmtChans = DevFmtQuad;
- break;
- case 6:
- mDevice->FmtChans = DevFmtX51Rear;
- break;
- case 7:
- mDevice->FmtChans = DevFmtX61;
- break;
- case 8:
- mDevice->FmtChans = DevFmtX71;
- break;
- default:
- if(mStream->getChannelCount() < 1)
+ if(mStream->getChannelCount() >= 2)
+ mDevice->FmtChans = DevFmtStereo;
+ else if(mStream->getChannelCount() == 1)
+ mDevice->FmtChans = DevFmtMono;
+ else
throw al::backend_exception{al::backend_error::DeviceError,
"Got unhandled channel count: %d", mStream->getChannelCount()};
- /* Assume first two channels are front left/right. We can do a stereo
- * mix and keep the other channels silent.
- */
- mDevice->FmtChans = DevFmtStereo;
- break;
}
setDefaultWFXChannelOrder();
@@ -252,7 +229,6 @@ void OboeCapture::open(const char *name)
break;
case DevFmtQuad:
case DevFmtX51:
- case DevFmtX51Rear:
case DevFmtX61:
case DevFmtX71:
case DevFmtAmbi3D:
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index 7be7f031..eb65afa6 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -68,9 +68,6 @@ constexpr SLuint32 GetChannelMask(DevFmtChannels chans) noexcept
case DevFmtX51: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT |
SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY | SL_SPEAKER_SIDE_LEFT |
SL_SPEAKER_SIDE_RIGHT;
- case DevFmtX51Rear: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT |
- SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY | SL_SPEAKER_BACK_LEFT |
- SL_SPEAKER_BACK_RIGHT;
case DevFmtX61: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT |
SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY | SL_SPEAKER_BACK_CENTER |
SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT;
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 23bcecad..cece08a0 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -785,7 +785,7 @@ void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int
{ DevFmtX71, X71ChanMap },
{ DevFmtX61, X61ChanMap },
{ DevFmtX51, X51ChanMap },
- { DevFmtX51Rear, X51RearChanMap },
+ { DevFmtX51, X51RearChanMap },
{ DevFmtQuad, QuadChanMap },
{ DevFmtStereo, StereoChanMap },
{ DevFmtMono, MonoChanMap }
@@ -957,9 +957,6 @@ bool PulsePlayback::reset()
case DevFmtX51:
chanmap = X51ChanMap;
break;
- case DevFmtX51Rear:
- chanmap = X51RearChanMap;
- break;
case DevFmtX61:
chanmap = X61ChanMap;
break;
@@ -1238,9 +1235,6 @@ void PulseCapture::open(const char *name)
case DevFmtX51:
chanmap = X51ChanMap;
break;
- case DevFmtX51Rear:
- chanmap = X51RearChanMap;
- break;
case DevFmtX61:
chanmap = X61ChanMap;
break;
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index d38fc25d..e726e8f1 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -876,10 +876,9 @@ HRESULT WasapiPlayback::resetProxy()
mDevice->FmtChans = DevFmtX71;
else if(chancount >= 7 && (chanmask&X61Mask) == X6DOT1)
mDevice->FmtChans = DevFmtX61;
- else if(chancount >= 6 && (chanmask&X51Mask) == X5DOT1)
+ else if(chancount >= 6 && ((chanmask&X51Mask) == X5DOT1
+ || (chanmask&X51RearMask) == X5DOT1REAR))
mDevice->FmtChans = DevFmtX51;
- else if(chancount >= 6 && (chanmask&X51RearMask) == X5DOT1REAR)
- mDevice->FmtChans = DevFmtX51Rear;
else if(chancount >= 4 && (chanmask&QuadMask) == QUAD)
mDevice->FmtChans = DevFmtQuad;
else if(chancount >= 2 && (chanmask&StereoMask) == STEREO)
@@ -912,10 +911,6 @@ HRESULT WasapiPlayback::resetProxy()
OutputType.Format.nChannels = 6;
OutputType.dwChannelMask = X5DOT1;
break;
- case DevFmtX51Rear:
- OutputType.Format.nChannels = 6;
- OutputType.dwChannelMask = X5DOT1REAR;
- break;
case DevFmtX61:
OutputType.Format.nChannels = 7;
OutputType.dwChannelMask = X6DOT1;
@@ -995,10 +990,9 @@ HRESULT WasapiPlayback::resetProxy()
mDevice->FmtChans = DevFmtX71;
else if(chancount >= 7 && (chanmask&X61Mask) == X6DOT1)
mDevice->FmtChans = DevFmtX61;
- else if(chancount >= 6 && (chanmask&X51Mask) == X5DOT1)
+ else if(chancount >= 6 && ((chanmask&X51Mask) == X5DOT1
+ || (chanmask&X51RearMask) == X5DOT1REAR))
mDevice->FmtChans = DevFmtX51;
- else if(chancount >= 6 && (chanmask&X51RearMask) == X5DOT1REAR)
- mDevice->FmtChans = DevFmtX51Rear;
else if(chancount >= 4 && (chanmask&QuadMask) == QUAD)
mDevice->FmtChans = DevFmtQuad;
else if(chancount >= 2 && (chanmask&StereoMask) == STEREO)
@@ -1421,10 +1415,6 @@ HRESULT WasapiCapture::resetProxy()
InputType.Format.nChannels = 6;
InputType.dwChannelMask = X5DOT1;
break;
- case DevFmtX51Rear:
- InputType.Format.nChannels = 6;
- InputType.dwChannelMask = X5DOT1REAR;
- break;
case DevFmtX61:
InputType.Format.nChannels = 7;
InputType.dwChannelMask = X6DOT1;
@@ -1509,7 +1499,6 @@ HRESULT WasapiCapture::resetProxy()
return (chancount == 4 && (chanmask == 0 || (chanmask&QuadMask) == QUAD));
/* 5.1 (Side) and 5.1 (Rear) are interchangeable here. */
case DevFmtX51:
- case DevFmtX51Rear:
return (chancount == 6 && (chanmask == 0 || (chanmask&X51Mask) == X5DOT1
|| (chanmask&X51RearMask) == X5DOT1REAR));
case DevFmtX61:
diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp
index 259cbc62..b0ead591 100644
--- a/alc/backends/wave.cpp
+++ b/alc/backends/wave.cpp
@@ -269,7 +269,6 @@ bool WaveBackend::reset()
case DevFmtStereo: chanmask = 0x01 | 0x02; break;
case DevFmtQuad: chanmask = 0x01 | 0x02 | 0x10 | 0x20; break;
case DevFmtX51: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x200 | 0x400; break;
- case DevFmtX51Rear: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020; break;
case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break;
case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break;
case DevFmtAmbi3D:
diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp
index 5a2f00f8..e0e82283 100644
--- a/alc/backends/winmm.cpp
+++ b/alc/backends/winmm.cpp
@@ -476,7 +476,6 @@ void WinMMCapture::open(const char *name)
case DevFmtQuad:
case DevFmtX51:
- case DevFmtX51Rear:
case DevFmtX61:
case DevFmtX71:
case DevFmtAmbi3D: