MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Core.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @file API/Core.hpp
5 * @brief Core engine lifecycle and configuration API
6 *
7 * This header provides the fundamental engine control and configuration
8 * functions that form the foundation of the MayaFlux framework. All other
9 * subsystems depend on the engine being properly initialized and configured.
10 *
11 * The Core API handles:
12 * - Engine initialization with various stream configurations
13 * - Engine lifecycle management (Start, Pause, Resume, End)
14 * - Access to core engine context and configuration
15 * - Global stream information queries
16 *
17 * This is typically the first API users interact with when setting up
18 * a MayaFlux application, and other API modules depend on these functions
19 * for accessing engine subsystems.
20 */
21namespace MayaFlux {
22
23namespace Core {
24 struct GlobalStreamInfo;
25 struct GlobalGraphicsConfig;
26 struct GlobalInputConfig;
27 struct GlobalNetworkConfig;
28 class Engine;
29}
30
31//-------------------------------------------------------------------------
32// Engine Management
33//-------------------------------------------------------------------------
34
35/**
36 * @brief Checks if the default engine has been initialized
37 * @return true if the engine is initialized, false otherwise
38 */
39MAYAFLUX_API bool is_initialized();
40
41/**
42 * @brief Checks if the default engine has currently accepted all configurations and initialized all managers
43 * @return true if the engine is fully configured and ready for processing, false otherwise
44 */
45MAYAFLUX_API bool is_configured();
46
47/**
48 * @brief Gets the default engine instance
49 * @return Reference to the default Engine
50 *
51 * Creates the engine if it doesn't exist yet. This is the centrally managed
52 * engine instance that all convenience functions in this namespace operate on.
53 */
54MAYAFLUX_API Core::Engine& get_context();
55
56/**
57 * @brief Initializes the default engine with specified parameters
58 * @param sample_rate Audio sample rate in Hz
59 * @param buffer_size Size of audio processing buffer in frames
60 * @param num_out_channels Number of output channels
61 * @param num_in_channels Number of input channels
62 *
63 * Convenience wrapper for Engine::Init() on the default engine.
64 */
65MAYAFLUX_API void Init(uint32_t sample_rate, uint32_t buffer_size = 512, uint32_t num_out_channels = 2, uint32_t num_in_channels = 0);
66
67/**
68 * @brief Initializes the default engine with default settings
69 *
70 * Convenience wrapper for Engine::Init() on the default engine.
71 */
72MAYAFLUX_API void Init();
73
74/**
75 * @brief Initializes the default engine with specified stream and graphics info
76 * @param stream_info Configuration for sample rate, buffer size, and channels
77 * @param graphics_info Configuration for graphics/windowing backend
78 * @param input_config Configuration for input handling
79 * @param network_config Configuration for network subsystem
80 *
81 * Convenience wrapper for Engine::Init() on the default engine.
82 */
83MAYAFLUX_API void Init(Core::GlobalStreamInfo stream_info, Core::GlobalGraphicsConfig graphics_config, Core::GlobalInputConfig input_config, Core::GlobalNetworkConfig network_config);
84
85/**
86 * @brief Starts audio processing on the default engine
87 *
88 * Convenience wrapper for Engine::Start() on the default engine.
89 */
90MAYAFLUX_API void Start();
91
92/**
93 * @brief Pauses audio processing on the default engine
94 *
95 * Convenience wrapper for Engine::Pause() on the default engine.
96 */
97MAYAFLUX_API void Pause();
98
99/**
100 * @brief Resumes audio processing on the default engine
101 *
102 * Convenience wrapper for Engine::Resume() on the default engine.
103 */
104MAYAFLUX_API void Resume();
105
106/**
107 * @brief Blocks launcher until Ctrl-C is pressed (optional convenience function)
108 *
109 * Use this only in launcher applications that need to block the main
110 * thread until shutdown is requested.
111 *
112 * Gates on SIGINT (Ctrl-C) alone, on every platform. Never reads or
113 * consumes stdin, so stdin-driven backends (unix pipe, fileio) remain free
114 * to use it while this call blocks.
115 *
116 * Usage (optional):
117 * ```cpp
118 * engine->start_graphics();
119 * std::cout << "Press Ctrl-C to stop...\n";
120 * MayaFlux::Await(); // Blocks here (optional)
121 * engine->stop_graphics();
122 * ```
123 */
124MAYAFLUX_API void Await();
125
126/**
127 * @brief Stops and cleans up the default engine
128 *
129 * Convenience wrapper for Engine::End() on the default engine.
130 */
131MAYAFLUX_API void End();
132
133}
@ Core
Core engine, backend, subsystems.
void Resume()
Resumes audio processing on the default engine.
Definition Core.cpp:142
void Start()
Starts audio processing on the default engine.
Definition Core.cpp:130
bool is_initialized()
Checks if the default engine has been initialized.
Definition Core.cpp:85
bool is_configured()
Checks if the default engine has currently accepted all configurations and initialized all managers.
Definition Core.cpp:93
void Pause()
Pauses audio processing on the default engine.
Definition Core.cpp:135
void Init()
Initializes the default engine with default settings.
Definition Core.cpp:106
Core::Engine & get_context()
Gets the default engine instance.
Definition Core.cpp:101
void Await()
Blocks launcher until Ctrl-C is pressed (optional convenience function)
Definition Core.cpp:149
void End()
Stops and cleans up the default engine.
Definition Core.cpp:156
Main namespace for the Maya Flux audio engine.
Definition Runtime.cpp:12