|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
Thread-safe global access point for audio system resources. More...
#include <RtAudioSingleton.hpp>
Collaboration diagram for MayaFlux::Core::RtAudioSingleton:Static Public Member Functions | |
| static void | cleanup () |
| Releases all audio system resources. | |
| static RtAudio * | get_instance () |
| Provides access to the RtAudio instance with lazy initialization. | |
| static bool | is_stream_open () |
| Checks if an audio stream is currently active. | |
| 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. | |
| static void | set_preferred_api (RtAudio::Api api) |
| Sets the preferred audio API before instance creation. | |
Private Member Functions | |
| RtAudioSingleton ()=default | |
| Private constructor prevents direct instantiation. | |
Static Private Attributes | |
| static std::unique_ptr< RtAudio > | s_instance = nullptr |
| Singleton instance of the RtAudio driver (nullptr until first access) | |
| static std::mutex | s_mutex |
| Synchronization primitive for thread-safe access to the singleton. | |
| static std::optional< RtAudio::Api > | s_preferred_api = std::nullopt |
| Preferred RtAudio API, if specified. | |
| static bool | s_stream_open = false |
| Stream state flag to enforce exclusive stream ownership. | |
Thread-safe global access point for audio system resources.
Implements the Singleton pattern to provide controlled, centralized access to the RtAudio subsystem. Ensures that only one instance of the audio driver exists throughout the application lifecycle, preventing resource conflicts and maintaining system stability.
This class enforces strict resource management with the following guarantees:
Definition at line 26 of file RtAudioSingleton.hpp.