33 if (
ending.exchange(
true, std::memory_order_acq_rel)) {
34 while (
ending.load(std::memory_order_acquire)) {
35 std::this_thread::yield();
42 if (std::unique_ptr<Core::Engine> engine {
engine_ptr.load(std::memory_order_acquire) }) {
48 initialized.store(
false, std::memory_order_release);
49 engine_ptr.store(
nullptr, std::memory_order_release);
53 ending.store(
false, std::memory_order_release);
63 auto candidate = std::make_unique<Core::Engine>();
65 if (
engine_ptr.compare_exchange_strong(expected, candidate.get(),
66 std::memory_order_acq_rel, std::memory_order_acquire)) {
67 engine = candidate.release();
71 terminating.store(
false, std::memory_order_release);
112void Init(uint32_t sample_rate, uint32_t buffer_size, uint32_t num_out_channels, uint32_t num_in_channels)
115 auto& stream_info = engine.get_stream_info();
117 stream_info.sample_rate = sample_rate;
118 stream_info.buffer_size = buffer_size;
119 stream_info.output.channels = num_out_channels;
120 stream_info.input.channels = num_in_channels;
127 engine.Init(stream_info, graphics_config, input_config, network_config);
Core engine lifecycle and configuration API.
void await_shutdown()
Blocks until shutdown is requested (main thread event loop)
bool is_configured() const
Checks if the engine has been initialized and configured.
void Resume()
Resumes processing from paused state.
void Start()
Starts the coordinated processing of all subsystems.
void Pause()
Pauses all processing while maintaining system state.
Central lifecycle manager and component orchestrator for the MayaFlux processing system.
static void shutdown()
Shutdown the logging system.
thread_local bool cleaning_up
std::atomic< bool > ending
std::atomic< bool > initialized
std::atomic< bool > terminating
std::atomic< bool > atexit_registered
Core::Engine & get_or_create_engine()
void cleanup_persistent_store()
std::atomic< Core::Engine * > engine_ptr
The engine is published through a raw atomic pointer and is freed only after End() has joined every t...
void Resume()
Resumes audio processing on the default engine.
void Start()
Starts audio processing on the default engine.
bool is_initialized()
Checks if the default engine has been initialized.
bool is_configured()
Checks if the default engine has currently accepted all configurations and initialized all managers.
void Pause()
Pauses audio processing on the default engine.
void Init()
Initializes the default engine with default settings.
Core::Engine & get_context()
Gets the default engine instance.
void Await()
Blocks launcher until Ctrl-C is pressed (optional convenience function)
void End()
Stops and cleans up the default engine.
Main namespace for the Maya Flux audio engine.
Configuration for the NetworkSubsystem.
Comprehensive configuration for digital audio stream processing.