From 18f72e98ac00903e6a592945177488d0deb6a363 Mon Sep 17 00:00:00 2001 From: hspil <44721499+hspil@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:04:03 -0800 Subject: [PATCH] Fix compatibility with RtAudio 6+ API --- Streaming.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Streaming.cpp b/Streaming.cpp index 2ab31cd..719519c 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -227,22 +227,28 @@ int SoapyAudio::activateStream( resetBuffer = true; bufferedElems = 0; - try { -#ifndef _MSC_VER - opts.priority = sched_get_priority_max(SCHED_FIFO); -#endif - // opts.flags = RTAUDIO_MINIMIZE_LATENCY; - opts.flags = RTAUDIO_SCHEDULE_REALTIME; + #ifndef _MSC_VER + opts.priority = sched_get_priority_max(SCHED_FIFO); + #endif + // opts.flags = RTAUDIO_MINIMIZE_LATENCY; + opts.flags = RTAUDIO_SCHEDULE_REALTIME; - sampleRateChanged.store(false); - dac.openStream(NULL, &inputParameters, RTAUDIO_FLOAT32, sampleRate, &bufferLength, &_rx_callback, (void *) this, &opts); - dac.startStream(); - - streamActive = true; - } catch (RtAudioError& e) { - throw std::runtime_error("RtAudio init error '" + e.getMessage()); - } + sampleRateChanged.store(false); + RtAudioErrorType error = dac.openStream(NULL, &inputParameters, RTAUDIO_FLOAT32, sampleRate, &bufferLength, &_rx_callback, (void *) this, &opts); + + if (error) { + throw std::runtime_error("RtAudio init error" + dac.getErrorText()); + } + + dac.startStream(); + + if (error) { + throw std::runtime_error("RtAudio init error" + dac.getErrorText()); + } + + streamActive = true; + return 0; }