mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-12-06 12:43:35 +01:00
DolphinQt: Refresh audio routing device lists on backend change.
This commit is contained in:
1 parent
65b97f5049
commit
2281d37b0c
1 file changed
+23
-10
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user