diff --git a/sink_modules/audio_sink/src/main.cpp b/sink_modules/audio_sink/src/main.cpp index be438031..15b7c260 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); } @@ -290,4 +294,4 @@ MOD_EXPORT void _DELETE_INSTANCE_(void* instance) { MOD_EXPORT void _END_() { config.disableAutoSave(); config.save(); -} \ No newline at end of file +}