Skip to content

Commit 5a003e9

Browse files
committed
Address review comments.
1 parent f197cf6 commit 5a003e9

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

sink_modules/audio_sink/src/main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AudioSink : SinkManager::Sink {
3232
stereoPacker.init(_stream->sinkOut, 512);
3333

3434
#if RTAUDIO_VERSION_MAJOR >= 6
35-
audio.setErrorCallback(&reportErrorsAsException);
35+
audio.setErrorCallback(&errorCallback);
3636
#endif
3737

3838
bool created = false;
@@ -55,6 +55,9 @@ class AudioSink : SinkManager::Sink {
5555
#endif
5656
try {
5757
info = audio.getDeviceInfo(i);
58+
#if !defined(RTAUDIO_VERSION_MAJOR) || RTAUDIO_VERSION_MAJOR < 6
59+
if (!info.probed) { continue; }
60+
#endif
5861
if (info.outputChannels == 0) { continue; }
5962
if (info.isDefaultOutput) { defaultDevId = devList.size(); }
6063
devList.push_back(info);
@@ -63,7 +66,7 @@ class AudioSink : SinkManager::Sink {
6366
txtDevList += '\0';
6467
}
6568
catch (const std::exception& e) {
66-
flog::error("AudioSinkModule Error getting audio device info: id={0}: {1}", i, e.what());
69+
flog::error("AudioSinkModule Error getting audio device ({}) info: {}", i, e.what());
6770
}
6871
}
6972
selectByName(device);
@@ -164,14 +167,14 @@ class AudioSink : SinkManager::Sink {
164167
}
165168

166169
#if RTAUDIO_VERSION_MAJOR >= 6
167-
static void reportErrorsAsException(RtAudioErrorType type, const std::string& errorText) {
170+
static void errorCallback(RtAudioErrorType type, const std::string& errorText) {
168171
switch (type) {
169172
case RtAudioErrorType::RTAUDIO_NO_ERROR:
170173
return;
171174
case RtAudioErrorType::RTAUDIO_WARNING:
172175
case RtAudioErrorType::RTAUDIO_NO_DEVICES_FOUND:
173176
case RtAudioErrorType::RTAUDIO_DEVICE_DISCONNECT:
174-
flog::warn("AudioSink: {0} ({1})", errorText, (int)type);
177+
flog::warn("AudioSinkModule Warning: {} ({})", errorText, (int)type);
175178
break;
176179
default:
177180
throw std::runtime_error(errorText);

source_modules/audio_source/src/main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AudioSourceModule : public ModuleManager::Instance {
3636
this->name = name;
3737

3838
#if RTAUDIO_VERSION_MAJOR >= 6
39-
audio.setErrorCallback(&reportErrorsAsException);
39+
audio.setErrorCallback(&errorCallback);
4040
#endif
4141

4242
sampleRate = 48000.0;
@@ -97,6 +97,9 @@ class AudioSourceModule : public ModuleManager::Instance {
9797
// Get info
9898
auto info = audio.getDeviceInfo(i);
9999

100+
#if !defined(RTAUDIO_VERSION_MAJOR) || RTAUDIO_VERSION_MAJOR < 6
101+
if (!info.probed) { continue; }
102+
#endif
100103
// Check that it has a stereo input
101104
if (info.inputChannels < 2) { continue; }
102105

@@ -105,7 +108,7 @@ class AudioSourceModule : public ModuleManager::Instance {
105108
devices.define(info.name, info.name, dinfo);
106109
}
107110
catch (const std::exception& e) {
108-
flog::error("Error getting audio device info: id={0}: {1}", i, e.what());
111+
flog::error("Error getting audio device ({}) info: {}", i, e.what());
109112
}
110113
}
111114
}
@@ -263,14 +266,14 @@ class AudioSourceModule : public ModuleManager::Instance {
263266
}
264267

265268
#if RTAUDIO_VERSION_MAJOR >= 6
266-
static void reportErrorsAsException(RtAudioErrorType type, const std::string& errorText) {
269+
static void errorCallback(RtAudioErrorType type, const std::string& errorText) {
267270
switch (type) {
268271
case RtAudioErrorType::RTAUDIO_NO_ERROR:
269272
return;
270273
case RtAudioErrorType::RTAUDIO_WARNING:
271274
case RtAudioErrorType::RTAUDIO_NO_DEVICES_FOUND:
272275
case RtAudioErrorType::RTAUDIO_DEVICE_DISCONNECT:
273-
flog::warn("AudioSource: {0} ({1})", errorText, (int)type);
276+
flog::warn("AudioSourceModule Warning: {} ({})", errorText, (int)type);
274277
break;
275278
default:
276279
throw std::runtime_error(errorText);

0 commit comments

Comments
 (0)