|
MayaFlux 0.1.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 RtAudio * | get_instance () |
| Provides access to the RtAudio instance with lazy initialization. | |
| static void | mark_stream_open () |
| Registers an active audio stream in the system. | |
| static void | mark_stream_closed () |
| Deregisters an active audio stream from the system. | |
| static bool | is_stream_open () |
| Checks if an audio stream is currently active. | |
| static void | cleanup () |
| Releases all audio system resources. | |
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 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 24 of file RtAudioSingleton.hpp.