Skip to content

Commit

Permalink
Fix audio settings device info retrieval
Browse files Browse the repository at this point in the history
getDeviceInfo() expects a device ID, not an index.
  • Loading branch information
colugomusic committed Jul 10, 2024
1 parent ff98954 commit c0a6203
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions host/audio-settings-widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);

Expand Down

0 comments on commit c0a6203

Please sign in to comment.