summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/AudioCommon.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2026-11-18 13:26:48 -0600
committerGitHub <noreply@github.com>2026-11-18 13:26:48 -0600
commit2fe162866282fa2806d62f69aa053315d750ab91 (patch)
tree478b79ed071b9f714080922fb00f39cba4de948b /Source/Core/AudioCommon/AudioCommon.cpp
parent438b557ac328de38c5846278aa1d25d33d42a22c (diff)
parent1f32d345e287854948159b1a526737b3b8c8853b (diff)
Merge pull request #14973 from jordan-woyak/cubeb-backend-selection
CubebUtils: Allow selecting the backend that Cubeb uses.
Diffstat (limited to 'Source/Core/AudioCommon/AudioCommon.cpp')
-rw-r--r--Source/Core/AudioCommon/AudioCommon.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp
index 73e1094a69..b766815312 100644
--- a/Source/Core/AudioCommon/AudioCommon.cpp
+++ b/Source/Core/AudioCommon/AudioCommon.cpp
@@ -28,7 +28,7 @@ constexpr int AUDIO_VOLUME_MAX = 100;
static std::unique_ptr<SoundStream> CreateSoundStreamForBackend(std::string_view backend)
{
- if (backend == BACKEND_CUBEB && CubebStream::IsValid())
+ if (IsCubebBackend(backend) && CubebStream::IsValid())
return std::make_unique<CubebStream>();
else if (backend == BACKEND_OPENAL && OpenALStream::IsValid())
return std::make_unique<OpenALStream>();
@@ -135,13 +135,20 @@ std::vector<std::string> GetSoundBackends()
return backends;
}
+bool IsCubebBackend(std::string_view backend)
+{
+ // Cubeb may have its own backend specified after a slash.
+ // e.g. "Cubeb/wasapi"
+ return backend.substr(0, backend.find('/')) == BACKEND_CUBEB;
+}
+
bool SupportsDPL2Decoder(std::string_view backend)
{
#ifndef __APPLE__
if (backend == BACKEND_OPENAL)
return true;
#endif
- if (backend == BACKEND_CUBEB)
+ if (AudioCommon::IsCubebBackend(backend))
return true;
if (backend == BACKEND_PULSEAUDIO)
return true;
@@ -158,7 +165,8 @@ bool SupportsVolumeChanges(std::string_view backend)
// FIXME: this one should ask the backend whether it supports it.
// but getting the backend from string etc. is probably
// too much just to enable/disable a stupid slider...
- return backend == BACKEND_CUBEB || backend == BACKEND_OPENAL || backend == BACKEND_WASAPI;
+ return AudioCommon::IsCubebBackend(backend) || backend == BACKEND_OPENAL ||
+ backend == BACKEND_WASAPI;
}
void UpdateSoundStream(Core::System& system)