diff --git a/sink_modules/audio_sink/src/main.cpp b/sink_modules/audio_sink/src/main.cpp index c7098c89..a4c82118 100644 --- a/sink_modules/audio_sink/src/main.cpp +++ b/sink_modules/audio_sink/src/main.cpp @@ -32,7 +32,7 @@ public: stereoPacker.init(_stream->sinkOut, 512); #if RTAUDIO_VERSION_MAJOR >= 6 - audio.setErrorCallback(&reportErrorsAsException); + audio.setErrorCallback(&errorCallback); #endif bool created = false; @@ -55,6 +55,9 @@ public: #endif try { info = audio.getDeviceInfo(i); +#if !defined(RTAUDIO_VERSION_MAJOR) || RTAUDIO_VERSION_MAJOR < 6 + if (!info.probed) { continue; } +#endif if (info.outputChannels == 0) { continue; } if (info.isDefaultOutput) { defaultDevId = devList.size(); } devList.push_back(info); @@ -63,7 +66,7 @@ public: txtDevList += '\0'; } catch (const std::exception& e) { - flog::error("AudioSinkModule Error getting audio device info: id={0}: {1}", i, e.what()); + flog::error("AudioSinkModule Error getting audio device ({}) info: {}", i, e.what()); } } selectByName(device); @@ -164,14 +167,14 @@ public: } #if RTAUDIO_VERSION_MAJOR >= 6 - static void reportErrorsAsException(RtAudioErrorType type, const std::string& errorText) { + static void errorCallback(RtAudioErrorType type, const std::string& errorText) { switch (type) { case RtAudioErrorType::RTAUDIO_NO_ERROR: return; case RtAudioErrorType::RTAUDIO_WARNING: case RtAudioErrorType::RTAUDIO_NO_DEVICES_FOUND: case RtAudioErrorType::RTAUDIO_DEVICE_DISCONNECT: - flog::warn("AudioSink: {0} ({1})", errorText, (int)type); + flog::warn("AudioSinkModule Warning: {} ({})", errorText, (int)type); break; default: throw std::runtime_error(errorText); diff --git a/source_modules/audio_source/src/main.cpp b/source_modules/audio_source/src/main.cpp index cbaf08b8..e573a818 100644 --- a/source_modules/audio_source/src/main.cpp +++ b/source_modules/audio_source/src/main.cpp @@ -36,7 +36,7 @@ public: this->name = name; #if RTAUDIO_VERSION_MAJOR >= 6 - audio.setErrorCallback(&reportErrorsAsException); + audio.setErrorCallback(&errorCallback); #endif sampleRate = 48000.0; @@ -97,6 +97,9 @@ public: // Get info auto info = audio.getDeviceInfo(i); +#if !defined(RTAUDIO_VERSION_MAJOR) || RTAUDIO_VERSION_MAJOR < 6 + if (!info.probed) { continue; } +#endif // Check that it has a stereo input if (info.inputChannels < 2) { continue; } @@ -105,7 +108,7 @@ public: devices.define(info.name, info.name, dinfo); } catch (const std::exception& e) { - flog::error("Error getting audio device info: id={0}: {1}", i, e.what()); + flog::error("Error getting audio device ({}) info: {}", i, e.what()); } } } @@ -263,14 +266,14 @@ private: } #if RTAUDIO_VERSION_MAJOR >= 6 - static void reportErrorsAsException(RtAudioErrorType type, const std::string& errorText) { + static void errorCallback(RtAudioErrorType type, const std::string& errorText) { switch (type) { case RtAudioErrorType::RTAUDIO_NO_ERROR: return; case RtAudioErrorType::RTAUDIO_WARNING: case RtAudioErrorType::RTAUDIO_NO_DEVICES_FOUND: case RtAudioErrorType::RTAUDIO_DEVICE_DISCONNECT: - flog::warn("AudioSource: {0} ({1})", errorText, (int)type); + flog::warn("AudioSourceModule Warning: {} ({})", errorText, (int)type); break; default: throw std::runtime_error(errorText);