From c0a62030987febb59afb03858e8bf430ea858e48 Mon Sep 17 00:00:00 2001 From: Colugo Date: Wed, 10 Jul 2024 11:34:46 +0100 Subject: [PATCH] Fix audio settings device info retrieval getDeviceInfo() expects a device ID, not an index. --- host/audio-settings-widget.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/host/audio-settings-widget.cc b/host/audio-settings-widget.cc index 4a433b6..666973c 100644 --- a/host/audio-settings-widget.cc +++ b/host/audio-settings-widget.cc @@ -112,7 +112,8 @@ void AudioSettingsWidget::updateSampleRateList() { _sampleRateChooser->clear(); bool didSelectSampleRate = false; - auto info = _audio->getDeviceInfo(_deviceChooser->currentIndex()); + auto deviceIds = _audio->getDeviceIds(); + auto info = _audio->getDeviceInfo(deviceIds[_deviceChooser->currentIndex()]); for (size_t i = 0; i < info.sampleRates.size(); ++i) { int sr = info.sampleRates[i]; _sampleRateChooser->addItem(QString::number(sr)); @@ -135,10 +136,12 @@ void AudioSettingsWidget::updateDeviceList() { auto deviceCount = _audio->getDeviceCount(); bool deviceFound = false; + auto deviceIds = _audio->getDeviceIds(); // Populate the choices for (int i = 0; i < deviceCount; ++i) { - auto deviceInfo = _audio->getDeviceInfo(i); + auto deviceId = deviceIds[i]; + auto deviceInfo = _audio->getDeviceInfo(deviceId); QString name = QString::fromStdString(deviceInfo.name); _deviceChooser->addItem(name);