summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/soundio/soundmanagerconfig.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/soundio/soundmanagerconfig.cpp b/src/soundio/soundmanagerconfig.cpp
index 9d29275ffe..16d0997fdc 100644
--- a/src/soundio/soundmanagerconfig.cpp
+++ b/src/soundio/soundmanagerconfig.cpp
@@ -125,6 +125,9 @@ bool SoundManagerConfig::readFromDisk() {
}
}
+ QDomNodeList outElements(devElement.elementsByTagName(xmlElementOutput));
+ QDomNodeList inElements(devElement.elementsByTagName(xmlElementInput));
+
if (devicesMatchingByName == 0) {
continue;
} else if (devicesMatchingByName == 1) {
@@ -157,13 +160,25 @@ bool SoundManagerConfig::readFromDisk() {
if (hardwareDeviceId.name == deviceIdFromFile.name
&& hardwareDeviceId.alsaHwDevice == deviceIdFromFile.alsaHwDevice) {
deviceIdFromFile.portAudioIndex = hardwareDeviceId.portAudioIndex;
+ break;
+ }
+ }
+ } else {
+ // Check if the one of the matching devices has the configured in and output channels
+ for (const auto& soundDevice : soundDevices) {
+ SoundDeviceId hardwareDeviceId = soundDevice->getDeviceId();
+ if (hardwareDeviceId.name == deviceIdFromFile.name &&
+ soundDevice->getNumOutputChannels() >=
+ outElements.count() &&
+ soundDevice->getNumInputChannels() >=
+ inElements.count()) {
+ deviceIdFromFile.portAudioIndex = hardwareDeviceId.portAudioIndex;
+ break;
}
}
}
}
- QDomNodeList outElements(devElement.elementsByTagName(xmlElementOutput));
- QDomNodeList inElements(devElement.elementsByTagName(xmlElementInput));
for (int j = 0; j < outElements.count(); ++j) {
QDomElement outElement(outElements.at(j).toElement());
if (outElement.isNull()) {