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

◆ create_backend()

std::unique_ptr< IAudioBackend > MayaFlux::Core::AudioBackendFactory::create_backend ( Core::AudioBackendType  type,
std::optional< GlobalStreamInfo::AudioApi api_preference = std::nullopt 
)
static

Creates a specific audio backend implementation.

Parameters
typeIdentifier for the requested backend type
api_preferenceOptional preference for a specific audio API
Returns
Unique pointer to an IAudioBackend implementation

Instantiates and configures the appropriate backend implementation based on the specified type, abstracting the details of backend selection and initialization.

Definition at line 393 of file RtAudioBackend.cpp.

396{
397 switch (type) {
399 if (api_preference) {
400 auto pref_api = to_rtaudio_api(*api_preference);
401 if (pref_api != RtAudio::UNSPECIFIED) {
403 "Setting RtAudio preferred API to {}",
404 RtAudio::getApiDisplayName(pref_api));
405
407 to_rtaudio_api(*api_preference));
408 }
409 }
410 return std::make_unique<RtAudioBackend>();
411 default:
412 throw std::runtime_error("Unsupported audio backend type");
413 }
414}
#define MF_INFO(comp, ctx,...)
static void set_preferred_api(RtAudio::Api api)
Sets the preferred audio API before instance creation.
@ AudioBackend
Audio processing backend (RtAudio, JACK, ASIO)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::AudioBackend, MayaFlux::Journal::Core, MF_INFO, MayaFlux::Core::RTAUDIO, and MayaFlux::Core::RtAudioSingleton::set_preferred_api().

+ Here is the call graph for this function: