From 6cd09f9b609f6634d688df3c6ad17bf6330264e6 Mon Sep 17 00:00:00 2001 From: Benjamin Vernoux Date: Sun, 2 Jul 2023 16:44:47 +0200 Subject: [PATCH 1/2] 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++ --- sink_modules/audio_sink/src/main.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sink_modules/audio_sink/src/main.cpp b/sink_modules/audio_sink/src/main.cpp index be438031..1c94f2ba 100644 --- a/sink_modules/audio_sink/src/main.cpp +++ b/sink_modules/audio_sink/src/main.cpp @@ -45,16 +45,20 @@ public: int count = audio.getDeviceCount(); RtAudio::DeviceInfo info; for (int i = 0; i < count; i++) { - info = audio.getDeviceInfo(i); - if (!info.probed) { continue; } - if (info.outputChannels == 0) { continue; } - if (info.isDefaultOutput) { defaultDevId = devList.size(); } - devList.push_back(info); - deviceIds.push_back(i); - txtDevList += info.name; - txtDevList += '\0'; + try { + info = audio.getDeviceInfo(i); + if (!info.probed) { continue; } + if (info.outputChannels == 0) { continue; } + if (info.isDefaultOutput) { defaultDevId = devList.size(); } + devList.push_back(info); + deviceIds.push_back(i); + txtDevList += info.name; + txtDevList += '\0'; + } + catch (std::exception e) { + flog::error("AudioSinkModule Error getting audio device info: {0}", e.what()); + } } - selectByName(device); } From 87add9ad83d7e0ae3770a8291a2b355d25b62855 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 2 Jul 2023 17:03:52 +0200 Subject: [PATCH 2/2] Fix formatting --- sink_modules/audio_sink/src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sink_modules/audio_sink/src/main.cpp b/sink_modules/audio_sink/src/main.cpp index 1c94f2ba..15b7c260 100644 --- a/sink_modules/audio_sink/src/main.cpp +++ b/sink_modules/audio_sink/src/main.cpp @@ -56,7 +56,7 @@ public: txtDevList += '\0'; } catch (std::exception e) { - flog::error("AudioSinkModule Error getting audio device info: {0}", e.what()); + flog::error("AudioSinkModule Error getting audio device info: {0}", e.what()); } } selectByName(device); @@ -294,4 +294,4 @@ MOD_EXPORT void _DELETE_INSTANCE_(void* instance) { MOD_EXPORT void _END_() { config.disableAutoSave(); config.save(); -} \ No newline at end of file +}