summaryrefslogtreecommitdiffstats
path: root/src/soundio
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2021-04-12 23:30:03 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2021-04-12 23:30:03 +0200
commit34275ad38d8404ef9e27277b17e4afde8f275255 (patch)
treee7f99ef861c253d4162610859da513efecd849fc /src/soundio
parent3368023862a595807d0d9cc1237947a794899a18 (diff)
Pick the matching device with a suitable channel count in case of duplicate names
Diffstat (limited to 'src/soundio')
-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()) {