Skip to content

Commit 6cd09f9

Browse files
committed
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++
1 parent 8d05c1e commit 6cd09f9

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

sink_modules/audio_sink/src/main.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,20 @@ class AudioSink : SinkManager::Sink {
4545
int count = audio.getDeviceCount();
4646
RtAudio::DeviceInfo info;
4747
for (int i = 0; i < count; i++) {
48-
info = audio.getDeviceInfo(i);
49-
if (!info.probed) { continue; }
50-
if (info.outputChannels == 0) { continue; }
51-
if (info.isDefaultOutput) { defaultDevId = devList.size(); }
52-
devList.push_back(info);
53-
deviceIds.push_back(i);
54-
txtDevList += info.name;
55-
txtDevList += '\0';
48+
try {
49+
info = audio.getDeviceInfo(i);
50+
if (!info.probed) { continue; }
51+
if (info.outputChannels == 0) { continue; }
52+
if (info.isDefaultOutput) { defaultDevId = devList.size(); }
53+
devList.push_back(info);
54+
deviceIds.push_back(i);
55+
txtDevList += info.name;
56+
txtDevList += '\0';
57+
}
58+
catch (std::exception e) {
59+
flog::error("AudioSinkModule Error getting audio device info: {0}", e.what());
60+
}
5661
}
57-
5862
selectByName(device);
5963
}
6064

0 commit comments

Comments
 (0)