From 2281d37b0c9fddff2d4e5db7ce6152377fa4cc3d Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 16 Nov 2026 00:01:47 -0600 Subject: DolphinQt: Refresh audio routing device lists on backend change. --- Source/Core/DolphinQt/Settings/AudioPane.cpp | 33 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'Source') diff --git a/Source/Core/DolphinQt/Settings/AudioPane.cpp b/Source/Core/DolphinQt/Settings/AudioPane.cpp index 05170e40f0..a7985b4c3c 100644 --- a/Source/Core/DolphinQt/Settings/AudioPane.cpp +++ b/Source/Core/DolphinQt/Settings/AudioPane.cpp @@ -226,8 +226,11 @@ void AudioPane::CreateWidgets() playback_layout->setRowStretch(4, 1); playback_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - // Wiimote Audio Routing #ifdef HAVE_CUBEB + // Widgets just get an empty list for now. OnBackendChanged loads the real list. + const std::array output_devices; + + // Wiimote Audio Routing m_wiimote_routing_box = new QGroupBox(tr("Wii Remote Audio Routing")); auto* wiimote_routing_layout = new QVBoxLayout; m_wiimote_routing_box->setLayout(wiimote_routing_layout); @@ -236,12 +239,6 @@ void AudioPane::CreateWidgets() Config::MAIN_WIIMOTE_AUDIO_ROUTING_ENABLED); wiimote_routing_layout->addWidget(m_wiimote_routing_enable); - // Build device list once for all wiimote dropdowns - std::vector> output_devices; - output_devices.emplace_back(tr("Default Device"), QStringLiteral("")); - for (const auto& [id, name] : CubebUtils::ListOutputDevices()) - output_devices.emplace_back(QString::fromStdString(name), QString::fromStdString(id)); - for (std::size_t i = 0; i < 4; ++i) { auto* row_widget = new QWidget; @@ -258,10 +255,8 @@ void AudioPane::CreateWidgets() wiimote_routing_layout->addWidget(row_widget); } -#endif -// GBA Audio Routing -#ifdef HAVE_CUBEB + // GBA Audio Routing m_gba_routing_box = new QGroupBox(tr("GBA Audio Routing")); auto* gba_routing_layout = new QVBoxLayout; m_gba_routing_box->setLayout(gba_routing_layout); @@ -379,6 +374,24 @@ void AudioPane::OnBackendChanged() #ifdef HAVE_CUBEB UpdateWiimoteRoutingEnabled(); UpdateGBARoutingEnabled(); + + // Update GBA/Wiimote audio routing device lists. + std::vector> output_devices; + output_devices.emplace_back(QObject::tr("Default Device"), QStringLiteral("")); + + // TODO: It may make sense to update this list when physical devices are added/removed. + // Maybe just update the combobox when it's clicked on ? + + if (AudioCommon::IsCubebBackend(Config::Get(Config::MAIN_AUDIO_BACKEND))) + { + for (const auto& [id, name] : CubebUtils::ListOutputDevices()) + output_devices.emplace_back(QString::fromStdString(name), QString::fromStdString(id)); + } + + for (auto* const wiimote : m_wiimote_output_device) + wiimote->SetOptions(output_devices); + for (auto* const gba : m_gba_output_device) + gba->SetOptions(output_devices); #endif } -- cgit v1.2.3