54 std::lock_guard<std::mutex> lock(
s_mutex);
71 std::lock_guard<std::mutex> lock(
s_mutex);
73 throw std::runtime_error(
"Error: Attempted to open a second RtAudio stream when one is already open");
87 std::lock_guard<std::mutex> lock(
s_mutex);
100 std::lock_guard<std::mutex> lock(
s_mutex);
119 std::lock_guard<std::mutex> lock(
s_mutex);
129 }
catch (
const RtAudioErrorType& e) {
130 std::cerr <<
"Error during RtAudio cleanup: " <<
s_instance->getErrorText() << std::endl;
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 std::unique_ptr< RtAudio > s_instance
Singleton instance of the RtAudio driver (nullptr until first access)
static bool s_stream_open
Stream state flag to enforce exclusive stream ownership.
static RtAudio * get_instance()
Provides access to the RtAudio instance with lazy initialization.
static std::mutex s_mutex
Synchronization primitive for thread-safe access to the singleton.
static void mark_stream_open()
Registers an active audio stream in the system.
RtAudioSingleton()=default
Private constructor prevents direct instantiation.
static void cleanup()
Releases all audio system resources.
Thread-safe global access point for audio system resources.