MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Subsystem.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace MayaFlux::Core {
5
6enum class SubsystemType : uint8_t {
7 AUDIO,
10 CUSTOM
11};
12
13/**
14 * @class ISubsystem
15 * @brief Base interface for all subsystems in the MayaFlux processing architecture
16 *
17 * Defines the standard lifecycle and integration pattern for subsystems that
18 * participate in token-based multimodal processing. Each subsystem manages
19 * a specific processing domain (audio, video, custom) and coordinates with
20 * the central processing architecture through standardized interfaces.
21 *
22 * Subsystems follow a consistent lifecycle: register_callbacks() -> initialize()
23 * -> start() -> [processing] -> stop() -> shutdown()
24 */
25class MAYAFLUX_API ISubsystem {
26public:
27 virtual ~ISubsystem() = default;
28
29 /**
30 * @brief Register callback hooks for this domain
31 *
32 * Sets up domain-specific callbacks that will trigger token-based processing.
33 * This is where subsystems connect to their respective backend systems and
34 * establish the event loops that drive processing.
35 *
36 * Examples:
37 * - Audio: RtAudio callback registration for real-time audio processing
38 * - Visual: Vulkan present callback / OpenFrameworks draw loop integration
39 * - Windowing: GLFW event loops for UI and input handling
40 * - Custom: Application-specific timing or event-driven processing
41 *
42 * Called during subsystem setup before initialization. Should not start
43 * actual processing - only establish the callback infrastructure.
44 */
45 virtual void register_callbacks() = 0;
46
47 /**
48 * @brief Initialize with a handle provided by SubsystemManager
49 * @param handle Processing handle providing access to buffer and node operations
50 *
51 * The handle is borrowed - subsystem doesn't own it but uses it throughout
52 * its lifetime. This is where subsystems configure their processing resources,
53 * create initial nodes, setup buffer configurations, and prepare for operation.
54 *
55 * The handle provides token-scoped access to both buffer processing and node
56 * graph operations, ensuring the subsystem operates within its designated
57 * processing domain with proper thread safety and resource isolation.
58 */
59 virtual void initialize(SubsystemProcessingHandle& handle) = 0;
60
61 /**
62 * @brief Start the subsystem's processing/event loops
63 *
64 * Begins active processing. After this call, the subsystem should be
65 * actively responding to callbacks and processing data according to
66 * its domain requirements.
67 */
68 virtual void start() = 0;
69
70 /** @brief Stop the subsystem's processing/event loops */
71 virtual void stop() = 0;
72
73 /** @brief Pause the subsystem's processing/event loops */
74 virtual void pause() = 0;
75
76 /** @brief Resume the subsystem's processing/event loops */
77 virtual void resume() = 0;
78
79 /**
80 * @brief Get the processing token configuration this subsystem manages
81 * @return SubsystemTokens defining buffer and node processing characteristics
82 *
83 * Returns the token configuration that defines how this subsystem processes
84 * buffers and nodes. Used by the SubsystemManager for routing and coordination.
85 * Should remain constant throughout the subsystem's lifetime.
86 */
87 [[nodiscard]] virtual SubsystemTokens get_tokens() const = 0;
88
89 /** @brief Check if subsystem is ready for operation */
90 [[nodiscard]] virtual bool is_ready() const = 0;
91
92 /** @brief Check if subsystem is currently processing */
93 [[nodiscard]] virtual bool is_running() const = 0;
94
95 /** @brief Shutdown and cleanup subsystem resources */
96 virtual void shutdown() = 0;
97
98 /** @brief Get the type of this subsystem */
99 [[nodiscard]] virtual SubsystemType get_type() const = 0;
100
101 /** @brief Get the processing context handle for this subsystem */
103};
104
105}
Unified processing architecture for multimodal subsystem coordination.
virtual SubsystemProcessingHandle * get_processing_context_handle()=0
Get the processing context handle for this subsystem.
virtual void start()=0
Start the subsystem's processing/event loops.
virtual SubsystemTokens get_tokens() const =0
Get the processing token configuration this subsystem manages.
virtual bool is_ready() const =0
Check if subsystem is ready for operation.
virtual void stop()=0
Stop the subsystem's processing/event loops.
virtual void pause()=0
Pause the subsystem's processing/event loops.
virtual SubsystemType get_type() const =0
Get the type of this subsystem.
virtual void resume()=0
Resume the subsystem's processing/event loops.
virtual void initialize(SubsystemProcessingHandle &handle)=0
Initialize with a handle provided by SubsystemManager.
virtual ~ISubsystem()=default
virtual void shutdown()=0
Shutdown and cleanup subsystem resources.
virtual void register_callbacks()=0
Register callback hooks for this domain.
virtual bool is_running() const =0
Check if subsystem is currently processing.
Base interface for all subsystems in the MayaFlux processing architecture.
Definition Subsystem.hpp:25
Unified interface combining buffer and node processing for subsystems.
Processing token configuration for subsystem operation.