From b26d79dc5737b32c392f06206b42b41ad13e0d0f Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 25 Nov 2019 12:01:31 -0500 Subject: [PATCH] Use first audio driver if driver ID is not found. --- src/audio.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/audio.cpp b/src/audio.cpp index 502e1d86..f14ecc2f 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -94,17 +94,16 @@ void Port::setDriverId(int driverId) { driver = NULL; this->driverId = -1; - if (driverId == -1) { + // Find driver by ID + driver = audio::getDriver(driverId); + if (driver) { + this->driverId = driverId; + } + else { // Set first driver as default driver = drivers[0].second; this->driverId = drivers[0].first; } - else { - // Find driver by ID - driver = audio::getDriver(driverId); - if (driver) - this->driverId = driverId; - } } void Port::setDeviceId(int deviceId) {