Skip to content

Commit d18bd72

Browse files
committed
Fix build with RtAudio > 6
1 parent d596e31 commit d18bd72

2 files changed

Lines changed: 10 additions & 22 deletions

File tree

src/infra/audio/implementation/librtaudio/audio_player_rt_audio.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,11 @@ uint32_t AudioPlayerRtAudio::initializeSoundStream(uint32_t deviceId, uint32_t c
125125
// Set a priority name for the thread (helpful for debugging in 'top' or 'htop')
126126
streamOptions.streamName = TAG;
127127

128-
try {
129-
uint32_t bufferFrames = bufferSize;
130-
m_rtAudio.openStream(&streamParameters, nullptr, RTAUDIO_SINT32,
131-
sampleRate, &bufferFrames,
132-
&AudioPlayerRtAudio::playCallback, this, &streamOptions);
133-
m_rtAudio.startStream();
134-
} catch (RtAudioError & e) {
135-
// Log the error (e.g., if the hardware doesn't support the requested buffer size)
136-
e.printMessage();
137-
return 0;
138-
}
128+
uint32_t bufferFrames = bufferSize;
129+
m_rtAudio.openStream(&streamParameters, nullptr, RTAUDIO_SINT32,
130+
sampleRate, &bufferFrames,
131+
&AudioPlayerRtAudio::playCallback, this, &streamOptions);
132+
m_rtAudio.startStream();
139133

140134
return m_rtAudio.getStreamSampleRate();
141135
}

src/infra/audio/implementation/librtaudio/audio_recorder_rt_audio.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,11 @@ uint32_t AudioRecorderRtAudio::initializeSoundStream(uint32_t deviceId, uint32_t
105105
streamOptions.numberOfBuffers = 2;
106106
streamOptions.streamName = "NoteaheadRecorder";
107107

108-
try {
109-
uint32_t bufferFrames = bufferSize;
110-
m_rtAudio.openStream(nullptr, &streamParameters, RTAUDIO_SINT32,
111-
sampleRate, &bufferFrames,
112-
&AudioRecorderRtAudio::recordCallback, this, &streamOptions);
113-
m_rtAudio.startStream();
114-
} catch (RtAudioError & e) {
115-
// In recording, if 'hw:' is busy, this will catch the 'Device Busy' error
116-
e.printMessage();
117-
return 0;
118-
}
108+
uint32_t bufferFrames = bufferSize;
109+
m_rtAudio.openStream(nullptr, &streamParameters, RTAUDIO_SINT32,
110+
sampleRate, &bufferFrames,
111+
&AudioRecorderRtAudio::recordCallback, this, &streamOptions);
112+
m_rtAudio.startStream();
119113

120114
return m_rtAudio.getStreamSampleRate();
121115
}

0 commit comments

Comments
 (0)