MayaFlux 0.1.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 class Engine;
27}
28
29//-------------------------------------------------------------------------
30// Engine Management
31//-------------------------------------------------------------------------
32
33/**
34 * @brief Checks if the default engine has been initialized
35 * @return true if the engine is initialized, false otherwise
36 */
37bool is_initialized();
38
39/**
40 * @brief Gets the default engine instance
41 * @return Reference to the default Engine
42 *
43 * Creates the engine if it doesn't exist yet. This is the centrally managed
44 * engine instance that all convenience functions in this namespace operate on.
45 */
46MAYAFLUX_API Core::Engine& get_context();
47
48/**
49 * @brief Replaces the default engine with a new instance
50 * @param instance New engine instance to use as default
51 *
52 * Transfers state from the old engine to the new one if possible.
53 *
54 * @warning This function uses move semantics. After calling this function,
55 * the engine instance passed as parameter will be left in a moved-from state
56 * and should not be used further. This is intentional to avoid resource duplication
57 * and ensure proper transfer of ownership. Users should be careful to not access
58 * the moved-from instance after calling this function.
59 *
60 * This function is intended for advanced use cases where custom engine configuration
61 * is required beyond what the standard initialization functions provide.
62 */
63MAYAFLUX_API void set_and_transfer_context(Core::Engine instance);
64
65/**
66 * @brief Initializes the default engine with specified parameters
67 * @param sample_rate Audio sample rate in Hz
68 * @param buffer_size Size of audio processing buffer in frames
69 * @param num_out_channels Number of output channels
70 * @param num_in_channels Number of input channels
71 *
72 * Convenience wrapper for Engine::Init() on the default engine.
73 */
74MAYAFLUX_API void Init(uint32_t sample_rate, uint32_t buffer_size = 512, uint32_t num_out_channels = 2, uint32_t num_in_channels = 0);
75
76/**
77 * @brief Initializes the default engine with default settings
78 *
79 * Convenience wrapper for Engine::Init() on the default engine.
80 */
81MAYAFLUX_API void Init();
82
83/**
84 * @brief Initializes the default engine with specified stream info
85 * @param stream_info Configuration for sample rate, buffer size, and channels
86 *
87 * Convenience wrapper for Engine::Init() on the default engine.
88 */
89MAYAFLUX_API void Init(Core::GlobalStreamInfo stream_info);
90
91/**
92 * @brief Initializes the default engine with specified stream and graphics info
93 * @param stream_info Configuration for sample rate, buffer size, and channels
94 * @param graphics_info Configuration for graphics/windowing backend
95 *
96 * Convenience wrapper for Engine::Init() on the default engine.
97 */
98MAYAFLUX_API void Init(Core::GlobalStreamInfo stream_info, Core::GlobalGraphicsConfig graphics_config);
99
100/**
101 * @brief Starts audio processing on the default engine
102 *
103 * Convenience wrapper for Engine::Start() on the default engine.
104 */
105MAYAFLUX_API void Start();
106
107/**
108 * @brief Pauses audio processing on the default engine
109 *
110 * Convenience wrapper for Engine::Pause() on the default engine.
111 */
112MAYAFLUX_API void Pause();
113
114/**
115 * @brief Resumes audio processing on the default engine
116 *
117 * Convenience wrapper for Engine::Resume() on the default engine.
118 */
119MAYAFLUX_API void Resume();
120
121/**
122 * @brief Stops and cleans up the default engine
123 *
124 * Convenience wrapper for Engine::End() on the default engine.
125 */
126MAYAFLUX_API void End();
127
128}
@ Core
Core engine, backend, subsystems.
void Resume()
Resumes audio processing on the default engine.
Definition Core.cpp:126
void Start()
Starts audio processing on the default engine.
Definition Core.cpp:114
void Pause()
Pauses audio processing on the default engine.
Definition Core.cpp:119
void Init()
Initializes the default engine with default settings.
Definition Core.cpp:84
void set_and_transfer_context(Core::Engine instance)
Replaces the default engine with a new instance.
Definition Core.cpp:61
Core::Engine & get_context()
Gets the default engine instance.
Definition Core.cpp:56
bool is_initialized()
Checks if the default engine has been initialized.
Definition Core.cpp:51
void End()
Stops and cleans up the default engine.
Definition Core.cpp:133
Main namespace for the Maya Flux audio engine.
Definition LiveAid.hpp:6