MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ configure_stream_options()

void MayaFlux::Core::RtAudioStream::configure_stream_options ( )
private

Configures RtAudio stream options based on GlobalStreamInfo.

Maps the engine's stream configuration parameters to the corresponding RtAudio-specific options.

Definition at line 168 of file RtAudioBackend.cpp.

169{
170 m_options.flags = 0;
171
172 switch (m_stream_info.priority) {
174 m_options.flags |= RTAUDIO_SCHEDULE_REALTIME;
175 break;
177 default:
178 break;
179 }
180
182 m_options.flags |= RTAUDIO_NONINTERLEAVED;
183 }
184
185 if (m_stream_info.buffer_count > 0) {
186 m_options.numberOfBuffers = static_cast<unsigned int>(m_stream_info.buffer_count);
187 }
188
189 m_options.priority = 0;
190
191 auto rtSpecificOpt = m_stream_info.backend_options.find("rtaudio.exclusive");
192 if (rtSpecificOpt != m_stream_info.backend_options.end()) {
193 try {
194 bool exclusive = std::any_cast<bool>(rtSpecificOpt->second);
195 if (exclusive) {
196#ifdef _WIN32
197 m_options.flags |= RtAudio::Api::WINDOWS_WASAPI;
198#endif
199 }
200 } catch (const std::bad_any_cast&) {
204 std::source_location::current(),
205 "Invalid type for rtaudio.exclusive option; expected bool");
206 }
207 }
208}
RtAudio::StreamOptions m_options
RtAudio-specific stream options.
GlobalStreamInfo m_stream_info
Copy of the stream configuration for reference.
@ 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.
@ Core
Core engine, backend, subsystems.
@ REALTIME
Maximum resource priority with timing guarantees.
StreamPriority priority
System resource priority for audio processing.
double buffer_count
Number of buffers in the processing queue (0 for system default)
std::unordered_map< std::string, std::any > backend_options
Backend-specific configuration parameters.
bool non_interleaved
Channel organization mode (true: planar, false: interleaved)

References MayaFlux::Journal::AudioBackend, MayaFlux::Core::GlobalStreamInfo::backend_options, MayaFlux::Core::GlobalStreamInfo::buffer_count, MayaFlux::Journal::Core, MayaFlux::Core::GlobalStreamInfo::HIGH, m_options, m_stream_info, MayaFlux::Core::GlobalStreamInfo::non_interleaved, MayaFlux::Core::GlobalStreamInfo::priority, and MayaFlux::Core::GlobalStreamInfo::REALTIME.

Referenced by RtAudioStream().

+ Here is the caller graph for this function: