Workaround for RtAudio Exception when no Input are connected on MIC IN on some computer

Issue reproduced with Windows11 Pro + ROG CROSSHAIR X670E HERO
Workaround for RtAudio just add try/catch and log the error but allow to start SDR++
This commit is contained in:
Benjamin Vernoux 2023-07-02 16:44:47 +02:00
parent 8d05c1e181
commit 6cd09f9b60

View File

@ -45,6 +45,7 @@ public:
int count = audio.getDeviceCount(); int count = audio.getDeviceCount();
RtAudio::DeviceInfo info; RtAudio::DeviceInfo info;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
try {
info = audio.getDeviceInfo(i); info = audio.getDeviceInfo(i);
if (!info.probed) { continue; } if (!info.probed) { continue; }
if (info.outputChannels == 0) { continue; } if (info.outputChannels == 0) { continue; }
@ -54,7 +55,10 @@ public:
txtDevList += info.name; txtDevList += info.name;
txtDevList += '\0'; txtDevList += '\0';
} }
catch (std::exception e) {
flog::error("AudioSinkModule Error getting audio device info: {0}", e.what());
}
}
selectByName(device); selectByName(device);
} }