aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends')
-rw-r--r--alc/backends/base.cpp74
-rw-r--r--alc/backends/base.h5
-rw-r--r--alc/backends/coreaudio.cpp1
-rw-r--r--alc/backends/dsound.cpp6
-rw-r--r--alc/backends/oboe.cpp1
-rw-r--r--alc/backends/opensl.cpp3
-rw-r--r--alc/backends/pipewire.cpp1
-rw-r--r--alc/backends/pulseaudio.cpp2
-rw-r--r--alc/backends/wasapi.cpp6
-rw-r--r--alc/backends/wave.cpp2
-rw-r--r--alc/backends/winmm.cpp10
11 files changed, 40 insertions, 71 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
diff --git a/alc/backends/base.h b/alc/backends/base.h
index a3562f54..65bc636b 100644
--- a/alc/backends/base.h
+++ b/alc/backends/base.h
@@ -41,11 +41,6 @@ protected:
void setDefaultChannelOrder();
/** Sets the default channel order used by WaveFormatEx. */
void setDefaultWFXChannelOrder();
-
-#ifdef _WIN32
- /** Sets the channel order given the WaveFormatEx mask. */
- void setChannelOrderFromWFXMask(uint chanmask);
-#endif
};
using BackendPtr = std::unique_ptr<BackendBase>;
diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp
index ed85e2a9..b81bd58a 100644
--- a/alc/backends/coreaudio.cpp
+++ b/alc/backends/coreaudio.cpp
@@ -764,6 +764,7 @@ void CoreAudioCapture::open(const char *name)
case DevFmtX51:
case DevFmtX61:
case DevFmtX71:
+ case DevFmtX3D71:
case DevFmtAmbi3D:
throw al::backend_exception{al::backend_error::DeviceError, "%s not supported",
DevFmtChannelsString(mDevice->FmtChans)};
diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp
index 0edc286f..36c4cd78 100644
--- a/alc/backends/dsound.cpp
+++ b/alc/backends/dsound.cpp
@@ -421,6 +421,7 @@ bool DSoundPlayback::reset()
case DevFmtX51: OutputType.dwChannelMask = X5DOT1; break;
case DevFmtX61: OutputType.dwChannelMask = X6DOT1; break;
case DevFmtX71: OutputType.dwChannelMask = X7DOT1; break;
+ case DevFmtX3D71: OutputType.dwChannelMask = X7DOT1; break;
}
retry_open:
@@ -514,7 +515,7 @@ retry_open:
}
ResetEvent(mNotifyEvent);
- setChannelOrderFromWFXMask(OutputType.dwChannelMask);
+ setDefaultWFXChannelOrder();
return true;
}
@@ -635,6 +636,7 @@ void DSoundCapture::open(const char *name)
case DevFmtX51: InputType.dwChannelMask = X5DOT1; break;
case DevFmtX61: InputType.dwChannelMask = X6DOT1; break;
case DevFmtX71: InputType.dwChannelMask = X7DOT1; break;
+ case DevFmtX3D71:
case DevFmtAmbi3D:
WARN("%s capture not supported\n", DevFmtChannelsString(mDevice->FmtChans));
throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported",
@@ -689,7 +691,7 @@ void DSoundCapture::open(const char *name)
}
mBufferBytes = DSCBDescription.dwBufferBytes;
- setChannelOrderFromWFXMask(InputType.dwChannelMask);
+ setDefaultWFXChannelOrder();
mDevice->DeviceName = name;
}
diff --git a/alc/backends/oboe.cpp b/alc/backends/oboe.cpp
index 38f048cb..03930ad8 100644
--- a/alc/backends/oboe.cpp
+++ b/alc/backends/oboe.cpp
@@ -234,6 +234,7 @@ void OboeCapture::open(const char *name)
case DevFmtX51:
case DevFmtX61:
case DevFmtX71:
+ case DevFmtX3D71:
case DevFmtAmbi3D:
throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported",
DevFmtChannelsString(mDevice->FmtChans)};
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index 85a5f483..76b2095e 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -71,7 +71,8 @@ constexpr SLuint32 GetChannelMask(DevFmtChannels chans) noexcept
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;
- case DevFmtX71: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT |
+ case DevFmtX71:
+ case DevFmtX3D71: 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 | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT;
case DevFmtAmbi3D:
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp
index a19dcb61..95845158 100644
--- a/alc/backends/pipewire.cpp
+++ b/alc/backends/pipewire.cpp
@@ -1181,6 +1181,7 @@ spa_audio_info_raw make_spa_info(DeviceBase *device, bool is51rear, use_f32p_e u
break;
case DevFmtX61: map = X61Map; break;
case DevFmtX71: map = X71Map; break;
+ case DevFmtX3D71: map = X71Map; break;
case DevFmtAmbi3D:
info.flags |= SPA_AUDIO_FLAG_UNPOSITIONED;
info.channels = device->channelsFromFmt();
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 67e00234..30f486c7 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -893,6 +893,7 @@ bool PulsePlayback::reset()
chanmap = X61ChanMap;
break;
case DevFmtX71:
+ case DevFmtX3D71:
chanmap = X71ChanMap;
break;
}
@@ -1173,6 +1174,7 @@ void PulseCapture::open(const char *name)
case DevFmtX71:
chanmap = X71ChanMap;
break;
+ case DevFmtX3D71:
case DevFmtAmbi3D:
throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported",
DevFmtChannelsString(mDevice->FmtChans)};
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index 063fca98..4e0f67a2 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -926,6 +926,7 @@ HRESULT WasapiPlayback::resetProxy()
OutputType.dwChannelMask = X6DOT1;
break;
case DevFmtX71:
+ case DevFmtX3D71:
OutputType.Format.nChannels = 8;
OutputType.dwChannelMask = X7DOT1;
break;
@@ -1021,6 +1022,7 @@ HRESULT WasapiPlayback::resetProxy()
chansok = (chancount >= 7 && (chanmask&X61Mask) == X6DOT1);
break;
case DevFmtX71:
+ case DevFmtX3D71:
chansok = (chancount >= 8 && (chanmask&X71Mask) == X7DOT1);
break;
case DevFmtAmbi3D:
@@ -1087,7 +1089,7 @@ HRESULT WasapiPlayback::resetProxy()
const EndpointFormFactor formfactor{get_device_formfactor(mMMDev.get())};
mDevice->Flags.set(DirectEar, (formfactor == Headphones || formfactor == Headset));
- setChannelOrderFromWFXMask(OutputType.dwChannelMask);
+ setDefaultWFXChannelOrder();
hr = mClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
buf_time.count(), 0, &OutputType.Format, nullptr);
@@ -1476,6 +1478,7 @@ HRESULT WasapiCapture::resetProxy()
InputType.dwChannelMask = X7DOT1;
break;
+ case DevFmtX3D71:
case DevFmtAmbi3D:
return E_FAIL;
}
@@ -1556,6 +1559,7 @@ HRESULT WasapiCapture::resetProxy()
case DevFmtX61:
return (chancount == 7 && (chanmask == 0 || (chanmask&X61Mask) == X6DOT1));
case DevFmtX71:
+ case DevFmtX3D71:
return (chancount == 8 && (chanmask == 0 || (chanmask&X71Mask) == X7DOT1));
case DevFmtAmbi3D:
return (chanmask == 0 && chancount == device->channelsFromFmt());
diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp
index 6360166c..80e93f69 100644
--- a/alc/backends/wave.cpp
+++ b/alc/backends/wave.cpp
@@ -265,6 +265,8 @@ bool WaveBackend::reset()
case DevFmtX51: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x200 | 0x400; break;
case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break;
case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break;
+ /* NOTE: Same as 7.1. */
+ case DevFmtX3D71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break;
case DevFmtAmbi3D:
/* .amb output requires FuMa */
mDevice->mAmbiOrder = minu(mDevice->mAmbiOrder, 3);
diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp
index 0fdd8a02..14cc4f9e 100644
--- a/alc/backends/winmm.cpp
+++ b/alc/backends/winmm.cpp
@@ -301,23 +301,16 @@ bool WinMMPlayback::reset()
return false;
}
- uint chanmask{};
if(mFormat.nChannels >= 2)
- {
mDevice->FmtChans = DevFmtStereo;
- chanmask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
- }
else if(mFormat.nChannels == 1)
- {
mDevice->FmtChans = DevFmtMono;
- chanmask = SPEAKER_FRONT_CENTER;
- }
else
{
ERR("Unhandled channel count: %d\n", mFormat.nChannels);
return false;
}
- setChannelOrderFromWFXMask(chanmask);
+ setDefaultWFXChannelOrder();
uint BufferSize{mDevice->UpdateSize * mFormat.nChannels * mDevice->bytesFromFmt()};
@@ -476,6 +469,7 @@ void WinMMCapture::open(const char *name)
case DevFmtX51:
case DevFmtX61:
case DevFmtX71:
+ case DevFmtX3D71:
case DevFmtAmbi3D:
throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported",
DevFmtChannelsString(mDevice->FmtChans)};