Initializes the audio stream and allocates required resources.
Opens the RtAudio stream with the configured parameters, making it ready for data transfer. Does not start the actual data flow.
211{
213 return;
214 }
215
216 try {
217 RtAudioFormat
format = RTAUDIO_FLOAT64;
218
222 break;
225 break;
228 break;
231 break;
234 break;
235 }
236
237 RtAudio::StreamParameters* inputParamsPtr = nullptr;
238
242 }
243
245
246#ifdef MAYAFLUX_PLATFORM_LINUX
247 if (
m_context->getCurrentApi() == RtAudio::UNIX_JACK) {
248 setenv("PIPEWIRE_QUANTUM",
250 setenv("PIPEWIRE_LATENCY",
252 }
253#endif
254
256
259 inputParamsPtr,
260 format,
264 this,
266
270 "Audio backend changed buffer size from {} to {}. "
271 "Set GlobalStreamInfo.buffer_size = {} before initialization to avoid mismatch.",
273 }
274
276 } catch (const RtAudioErrorType& e) {
279
283 std::source_location::current(),
284 "Failed to open RtAudio stream: {}",
286 }
287}
#define MF_WARN(comp, ctx,...)
static void mark_stream_closed()
Deregisters an active audio stream from the system.
static void mark_stream_open()
Registers an active audio stream in the system.
RtAudio::StreamOptions m_options
RtAudio-specific stream options.
bool m_isOpen
Flag indicating if the stream is currently open.
GlobalStreamInfo & m_stream_info
Copy of the stream configuration for reference.
bool is_open() const override
Checks if the stream is initialized and ready for activation.
RtAudio::StreamParameters m_in_parameters
RtAudio-specific stream input configuration parameters.
RtAudio::StreamParameters m_out_parameters
RtAudio-specific stream output configuration parameters.
RtAudio * m_context
Pointer to the underlying RtAudio context.
static int rtAudioCallback(void *output_buffer, void *input_buffer, unsigned int num_frames, double stream_time, RtAudioStreamStatus status, void *user_data)
Static callback function for the RtAudio API.
@ AudioBackend
Audio processing backend (RtAudio, JACK, ASIO)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
std::string format_runtime(std::string_view fmt_str, Args &&... args)
std::string format(format_string< std::remove_cvref_t< Args >... > fmt_str, Args &&... args)
@ Core
Core engine, backend, subsystems.
uint32_t channels
Number of discrete channels in this set.
bool enabled
Whether this channel set is active in the stream.
uint32_t buffer_size
Number of samples per processing block.
ChannelConfig input
Configuration for input signal channels (disabled by default)
uint32_t sample_rate
Number of samples processed per second (Hz)
@ FLOAT64
64-bit floating point representation (-1.0 to 1.0)
@ INT16
16-bit integer representation (-32768 to 32767)
@ INT32
32-bit integer representation (-2147483648 to 2147483647)
@ INT24
24-bit integer representation (-8388608 to 8388607)
@ FLOAT32
32-bit floating point representation (-1.0 to 1.0)
AudioFormat format
Sample data format for stream processing.