MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Core::Engine Class Reference

Central lifecycle manager and component orchestrator for the MayaFlux processing system. More...

#include <Engine.hpp>

+ Collaboration diagram for MayaFlux::Core::Engine:

Public Member Functions

void await_shutdown ()
 Blocks until shutdown is requested (main thread event loop)
 
void End ()
 Stops all processing and performs clean shutdown.
 
 Engine ()
 Constructs a new Engine instance.
 
 Engine (const Engine &)=delete
 
 Engine (Engine &&other) noexcept
 Move constructor.
 
std::shared_ptr< Buffers::BufferManagerget_buffer_manager ()
 Gets the buffer manager.
 
std::shared_ptr< Vruta::EventManagerget_event_manager ()
 Gets the event manager.
 
GlobalGraphicsConfigget_graphics_config ()
 Gets the current graphics configuration.
 
GlobalInputConfigget_input_config ()
 Gets the current input configuration.
 
std::shared_ptr< InputManagerget_input_manager ()
 Gets the input manager.
 
std::shared_ptr< IO::IOManagerget_io_manager ()
 Gets the IO manager.
 
GlobalNetworkConfigget_network_config ()
 Gets the current network configuration.
 
Nodes::NodeConfigget_node_config ()
 Gets the current node processing configuration.
 
std::shared_ptr< Nodes::NodeGraphManagerget_node_graph_manager ()
 Gets the node graph manager.
 
std::shared_ptr< Vruta::TaskSchedulerget_scheduler ()
 Gets the task scheduler.
 
Kinesis::Stochastic::Stochasticget_stochastic_engine ()
 Gets the stochastic signal generator engine.
 
GlobalStreamInfoget_stream_info ()
 Gets the current stream configuration.
 
std::shared_ptr< ISubsystemget_subsystem (SubsystemType type)
 Get typed access to a specific subsystem.
 
std::shared_ptr< SubsystemManagerget_subsystem_manager ()
 Gets the subsystem manager for advanced component access.
 
std::shared_ptr< WindowManagerget_window_manager ()
 Gets the window manager.
 
void Init ()
 Initializes all system components and prepares for processing.
 
void Init (const GlobalStreamInfo &streamInfo)
 Initializes the processing engine with a custom stream configuration.
 
void Init (const GlobalStreamInfo &streamInfo, const GlobalGraphicsConfig &graphics_config, const GlobalInputConfig &input_config, const GlobalNetworkConfig &network_config)
 Initializes the processing engine with custom stream and graphics configurations.
 
bool is_configured () const
 Checks if the engine has been initialized and configured.
 
bool is_running () const
 Checks if the coordinated processing system is currently active.
 
bool is_shutdown_requested () const
 Check if shutdown has been requested.
 
Engineoperator= (const Engine &)=delete
 
Engineoperator= (Engine &&other) noexcept
 Move assignment operator.
 
void Pause ()
 Pauses all processing while maintaining system state.
 
void request_shutdown ()
 Request shutdown from any thread.
 
void Resume ()
 Resumes processing from paused state.
 
void set_node_config (const Nodes::NodeConfig &config)
 Sets the node processing configuration.
 
void Start ()
 Starts the coordinated processing of all subsystems.
 
 ~Engine ()
 Destroys the Engine instance and cleans up resources.
 

Private Attributes

std::shared_ptr< Buffers::BufferManagerm_buffer_manager
 Buffer manager.
 
std::shared_ptr< Vruta::EventManagerm_event_manager
 Event manager (currently only glfw events)
 
GlobalGraphicsConfig m_graphics_config {}
 Graphics/windowing configuration.
 
GlobalInputConfig m_input_config {}
 Input configuration.
 
std::shared_ptr< InputManagerm_input_manager
 Input manager (HID/MIDI/etc.)
 
std::shared_ptr< IO::IOManagerm_io_manager
 IO manager for video/audio loading and dispatch.
 
bool m_is_initialized {}
 
bool m_is_paused {}
 Pause state flag.
 
GlobalNetworkConfig m_network_config {}
 Network configuration.
 
Nodes::NodeConfig m_node_config {}
 Node processing configuration.
 
std::shared_ptr< Nodes::NodeGraphManagerm_node_graph_manager
 Node graph manager.
 
std::shared_ptr< Vruta::TaskSchedulerm_scheduler
 Task scheduler.
 
std::atomic< bool > m_should_shutdown { false }
 
std::unique_ptr< Kinesis::Stochastic::Stochasticm_stochastic_engine
 Core stochastic engine for random generation.
 
GlobalStreamInfo m_stream_info {}
 Stream configuration.
 
std::shared_ptr< SubsystemManagerm_subsystem_manager
 
std::shared_ptr< WindowManagerm_window_manager
 Window manager (Windowing subsystem)
 

Detailed Description

Central lifecycle manager and component orchestrator for the MayaFlux processing system.

The Engine serves as the primary entry point and lifecycle coordinator for MayaFlux, acting as:

  • Lifecycle Manager: Controls initialization, startup, pause/resume, and shutdown sequences
  • Component Initializer: Creates and configures core system components with proper dependencies
  • Access Router: Provides centralized access to all major subsystems and managers
  • Reference Holder: Maintains shared ownership of core components to ensure proper lifetime management

Core Responsibilities:

  1. System Initialization: Orchestrates the creation and configuration of all core components
  2. Lifecycle Control: Manages the start/stop/pause/resume cycle of the entire processing system
  3. Component Access: Provides unified access to subsystems (audio, scheduling, node graph, buffers)
  4. Resource Management: Ensures proper construction/destruction order and shared ownership

Architecture Philosophy: The Engine follows a "batteries included but replaceable" approach:

  • Provides sensible defaults and automatic component wiring for ease of use
  • Allows advanced users to access individual components directly for custom workflows
  • Enables completely custom component instantiation when needed

Usage Patterns:

Simple Usage (Recommended):

Engine engine;
engine.Init(48000, 512, 2, 0); // 48kHz, 512 samples, stereo out
engine.Start();
// Use engine.get_scheduler(), engine.get_node_graph_manager(), etc.
void Init()
Initializes all system components and prepares for processing.
Definition Engine.cpp:87
void Start()
Starts the coordinated processing of all subsystems.
Definition Engine.cpp:152
Central lifecycle manager and component orchestrator for the MayaFlux processing system.
Definition Engine.hpp:80

Advanced Usage:

Engine engine;
auto custom_scheduler = std::make_shared<CustomScheduler>();
engine.Init(stream_info);
// Replace default scheduler with custom implementation
engine.get_scheduler() = custom_scheduler;
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler.
Definition Engine.hpp:276

Offline Processing:

// Engine components can be used without hardware I/O
auto scheduler = engine.get_scheduler();
auto node_graph = engine.get_node_graph_manager();
// Process manually without Start()
std::shared_ptr< Nodes::NodeGraphManager > get_node_graph_manager()
Gets the node graph manager.
Definition Engine.hpp:267

The Engine does not perform direct signal processing or scheduling - it delegates these responsibilities to specialized subsystems while ensuring they work together coherently.

Definition at line 80 of file Engine.hpp.


The documentation for this class was generated from the following files: