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