diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2026-11-16 00:01:47 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2026-11-17 13:03:41 -0600 |
| commit | 2281d37b0c9fddff2d4e5db7ce6152377fa4cc3d (patch) | |
| tree | ae6558ceeed7d1420f24193d093f9e4d43c29751 /Source | |
| parent | 65b97f504901260aa94598e96e824e81d12c0995 (diff) | |
DolphinQt: Refresh audio routing device lists on backend change.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/DolphinQt/Settings/AudioPane.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
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<std::string, 0> 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<std::pair<QString, QString>> 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<std::pair<QString, QString>> 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 } |
