12#ifdef MAYAFLUX_PLATFORM_MACOS
13#include <CoreFoundation/CoreFoundation.h>
24 : m_rng(new Nodes::Generator::Stochastics::Random())
34 : m_stream_info(other.m_stream_info)
35 , m_graphics_config(other.m_graphics_config)
36 , m_is_paused(other.m_is_paused)
37 , m_is_initialized(other.m_is_initialized)
38 , m_should_shutdown(other.m_should_shutdown.load())
39 , m_scheduler(std::move(other.m_scheduler))
40 , m_node_graph_manager(std::move(other.m_node_graph_manager))
41 , m_buffer_manager(std::move(other.m_buffer_manager))
42 , m_subsystem_manager(std::move(other.m_subsystem_manager))
43 , m_window_manager(std::move(other.m_window_manager))
44 , m_event_manager(std::move(other.m_event_manager))
45 , m_rng(std::move(other.m_rng))
47 other.m_is_initialized =
false;
48 other.m_is_paused =
false;
56 m_stream_info = other.m_stream_info;
57 m_graphics_config = other.m_graphics_config;
59 m_subsystem_manager = std::move(other.m_subsystem_manager);
60 m_node_graph_manager = std::move(other.m_node_graph_manager);
61 m_buffer_manager = std::move(other.m_buffer_manager);
62 m_scheduler = std::move(other.m_scheduler);
63 m_window_manager = std::move(other.m_window_manager);
64 m_event_manager = std::move(other.m_event_manager);
65 m_rng = std::move(other.m_rng);
67 m_is_initialized = other.m_is_initialized;
68 m_is_paused = other.m_is_paused;
69 m_should_shutdown = other.m_should_shutdown.load();
71 other.m_is_initialized =
false;
72 other.m_is_paused =
false;
159 for (
const auto& [type, readiness] : status) {
160 const auto& [is_ready,
is_running] = readiness;
171#ifdef MAYAFLUX_PLATFORM_MACOS
172 run_macos_event_loop();
181 "Shutdown requested, awaiting all subsystem termination ......");
188#ifdef MAYAFLUX_PLATFORM_MACOS
189 CFRunLoopStop(CFRunLoopGetMain());
198#ifdef MAYAFLUX_PLATFORM_MACOS
199void Engine::run_macos_event_loop()
201 CFRunLoopRef runLoop = CFRunLoopGetMain();
203 dispatch_source_t stdinSource = dispatch_source_create(
204 DISPATCH_SOURCE_TYPE_READ,
207 dispatch_get_main_queue());
209 dispatch_source_set_event_handler(stdinSource, ^{
211 ssize_t bytes_read = read(STDIN_FILENO, buf,
sizeof(buf));
212 if (bytes_read > 0) {
217 dispatch_resume(stdinSource);
222 "Main thread event loop running (polling at {}fps)",
226 CFRunLoopRunInMode(kCFRunLoopDefaultMode, timeout_seconds,
false);
229 dispatch_source_cancel(stdinSource);
230 dispatch_release(stdinSource);
233 "Main thread event loop exiting");
262 for (
auto& window : windows) {
#define MF_INFO(comp, ctx,...)
#define MF_PRINT(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
void Init()
Initializes all system components and prepares for processing.
std::shared_ptr< SubsystemManager > m_subsystem_manager
void await_shutdown()
Blocks until shutdown is requested (main thread event loop)
GlobalGraphicsConfig m_graphics_config
Graphics/windowing configuration.
void request_shutdown()
Request shutdown from any thread.
void Resume()
Resumes processing from paused state.
std::shared_ptr< Vruta::EventManager > m_event_manager
Event manager (currently only glfw events)
std::shared_ptr< Buffers::BufferManager > m_buffer_manager
Buffer manager.
GlobalStreamInfo m_stream_info
Stream configuration.
bool is_running() const
Checks if the coordinated processing system is currently active.
void Start()
Starts the coordinated processing of all subsystems.
std::atomic< bool > m_should_shutdown
void Pause()
Pauses all processing while maintaining system state.
bool m_is_paused
Pause state flag.
std::shared_ptr< WindowManager > m_window_manager
Window manager (Windowing subsystem)
Engine()
Constructs a new Engine instance.
std::shared_ptr< Vruta::TaskScheduler > m_scheduler
Task scheduler.
~Engine()
Destroys the Engine instance and cleans up resources.
bool is_shutdown_requested() const
Check if shutdown has been requested.
void End()
Stops all processing and performs clean shutdown.
std::shared_ptr< Nodes::NodeGraphManager > m_node_graph_manager
Node graph manager.
Engine & operator=(const Engine &)=delete
Central lifecycle manager and component orchestrator for the MayaFlux processing system.
@ Init
Engine/subsystem initialization.
@ Runtime
General runtime operations (default fallback)
@ Core
Core engine, backend, subsystems.
void End()
Stops and cleans up the default engine.
@ NONE
No windowing (offscreen rendering only)
uint32_t target_frame_rate
Target frame rate for visual processing (Hz)
WindowingBackend windowing_backend
Selected windowing backend.
uint32_t channels
Number of discrete channels in this set.
bool enabled
Whether this channel set is active in the stream.
uint32_t buffer_size
Number of samples per processing block.
ChannelConfig input
Configuration for input signal channels (disabled by default)
uint32_t sample_rate
Number of samples processed per second (Hz)
ChannelConfig output
Configuration for output signal channels.
Comprehensive configuration for digital audio stream processing.