MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ ProcessingToken

Bitfield enum defining processing characteristics and backend requirements for buffer operations.

ProcessingToken provides a flexible bitfield system for specifying how buffers and their processors should be handled within the MayaFlux engine. These tokens enable fine-grained control over processing rate, execution location, and concurrency patterns, allowing the system to optimize resource allocation and execution strategies based on specific requirements.

The token system is designed as a bitfield to allow combination of orthogonal characteristics:

  • Rate Tokens: Define the temporal processing characteristics (SAMPLE_RATE vs FRAME_RATE)
  • Device Tokens: Specify execution location (CPU_PROCESS vs GPU_PROCESS)
  • Concurrency Tokens: Control execution pattern (SEQUENTIAL vs PARALLEL)
  • Backend Tokens: Predefined combinations optimized for specific use cases

This architecture enables the buffer system to make intelligent decisions about processor compatibility, resource allocation, and execution optimization while maintaining flexibility for custom processing scenarios.

Enumerator
SAMPLE_RATE 

Processes data at audio sample rate with buffer-sized chunks.

Evaluates one audio buffer size (typically 512 samples) at a time, executing at sample_rate/buffer_size frequency. This is the standard token for audio processing operations that work with discrete audio blocks in real-time processing scenarios.

FRAME_RATE 

Processes data at video frame rate.

Evaluates one video frame at a time, typically at 30-120 Hz depending on the video processing requirements. This token is optimized for video buffer operations and graphics processing workflows that operate on complete frame data.

EVENT_RATE 

Processes data on event arrival (async/sporadic)

Unlike SAMPLE_RATE (fixed audio callback) or FRAME_RATE (vsync), EVENT_RATE processes when external events arrive. Used for input devices, network messages, or other async data sources. Processing is triggered by event, not by timer.

CPU_PROCESS 

Executes processing operations on CPU threads.

Specifies that the processing should occur on CPU cores using traditional threading models. This is optimal for operations that benefit from CPU's sequential processing capabilities or require complex branching logic.

GPU_PROCESS 

Executes processing operations on GPU hardware.

Specifies that the processing should leverage GPU compute capabilities, typically through compute shaders, CUDA, or OpenCL. This is optimal for massively parallel operations that can benefit from GPU's parallel architecture.

SEQUENTIAL 

Processes operations sequentially, one after another.

Ensures that processing operations are executed in a deterministic order without parallelization. This is essential for operations where execution order affects the final result or when shared resources require serialized access.

PARALLEL 

Processes operations in parallel when possible.

Enables concurrent execution of processing operations when they can be safely parallelized. This maximizes throughput for operations that can benefit from parallel execution without introducing race conditions.

AUDIO_BACKEND 

Standard audio processing backend configuration.

Combines SAMPLE_RATE | CPU_PROCESS | SEQUENTIAL for traditional audio processing. This processes audio on the chosen backend using CPU threads in sequential order within the audio callback loop. This is the most common configuration for real-time audio processing applications.

GRAPHICS_BACKEND 

Standard graphics processing backend configuration.

Combines FRAME_RATE | GPU_PROCESS | PARALLEL for graphics processing. This processes video/graphics data on the chosen backend (default GLFW) using GPU hardware with parallel execution within the graphics callback loop. Optimal for real-time graphics processing and video effects.

AUDIO_PARALLEL 

High-performance audio processing with GPU acceleration.

Combines SAMPLE_RATE | GPU_PROCESS | PARALLEL for GPU-accelerated audio processing. This offloads audio processing to GPU hardware, typically using compute shaders for parallel execution. Useful for computationally intensive audio operations like convolution, FFT processing, or complex effects that benefit from GPU parallelization.

WINDOW_EVENTS 

Window event stream processing.

Processes window lifecycle events (resize, close, focus) and input events (keyboard, mouse) at frame rate using CPU in sequential order. This is distinct from graphics rendering - it handles the window container itself, not its visual content.

INPUT_BACKEND 

Input device processing backend configuration.

Combines EVENT_RATE | CPU_PROCESS | SEQUENTIAL for input handling. Processes input from HID, MIDI, OSC, Serial backends on the CPU in sequential order as events arrive. Input is inherently event-driven and doesn't follow fixed sample/frame timing.

CONTROL_DATA 

Control data processing (LFOs, envelopes, modulation)

Combines EVENT_RATE | CPU_PROCESS | PARALLEL for control signals. Control-rate data updates less frequently than audio but needs to be processed promptly when it changes.

Definition at line 91 of file ProcessingTokens.hpp.

91 : uint32_t {
92 /**
93 * @brief Processes data at audio sample rate with buffer-sized chunks
94 *
95 * Evaluates one audio buffer size (typically 512 samples) at a time, executing at
96 * sample_rate/buffer_size frequency. This is the standard token for audio processing
97 * operations that work with discrete audio blocks in real-time processing scenarios.
98 */
99 SAMPLE_RATE = 0x0,
100
101 /**
102 * @brief Processes data at video frame rate
103 *
104 * Evaluates one video frame at a time, typically at 30-120 Hz depending on the
105 * video processing requirements. This token is optimized for video buffer operations
106 * and graphics processing workflows that operate on complete frame data.
107 */
108 FRAME_RATE = 0x2,
109
110 /**
111 * @brief Processes data on event arrival (async/sporadic)
112 *
113 * Unlike SAMPLE_RATE (fixed audio callback) or FRAME_RATE (vsync),
114 * EVENT_RATE processes when external events arrive. Used for input
115 * devices, network messages, or other async data sources.
116 * Processing is triggered by event, not by timer.
117 */
118 EVENT_RATE = 0x40,
119
120 /**
121 * @brief Executes processing operations on CPU threads
122 *
123 * Specifies that the processing should occur on CPU cores using traditional
124 * threading models. This is optimal for operations that benefit from CPU's
125 * sequential processing capabilities or require complex branching logic.
126 */
127 CPU_PROCESS = 0x4,
128
129 /**
130 * @brief Executes processing operations on GPU hardware
131 *
132 * Specifies that the processing should leverage GPU compute capabilities,
133 * typically through compute shaders, CUDA, or OpenCL. This is optimal for
134 * massively parallel operations that can benefit from GPU's parallel architecture.
135 */
136 GPU_PROCESS = 0x8,
137
138 /**
139 * @brief Processes operations sequentially, one after another
140 *
141 * Ensures that processing operations are executed in a deterministic order
142 * without parallelization. This is essential for operations where execution
143 * order affects the final result or when shared resources require serialized access.
144 */
145 SEQUENTIAL = 0x10,
146
147 /**
148 * @brief Processes operations in parallel when possible
149 *
150 * Enables concurrent execution of processing operations when they can be
151 * safely parallelized. This maximizes throughput for operations that can
152 * benefit from parallel execution without introducing race conditions.
153 */
154 PARALLEL = 0x20,
155
156 /**
157 * @brief Standard audio processing backend configuration
158 *
159 * Combines SAMPLE_RATE | CPU_PROCESS | SEQUENTIAL for traditional audio processing.
160 * This processes audio on the chosen backend using CPU threads
161 * in sequential order within the audio callback loop. This is the most common
162 * configuration for real-time audio processing applications.
163 */
165
166 /**
167 * @brief Standard graphics processing backend configuration
168 *
169 * Combines FRAME_RATE | GPU_PROCESS | PARALLEL for graphics processing.
170 * This processes video/graphics data on the chosen backend (default GLFW) using
171 * GPU hardware with parallel execution within the graphics callback loop.
172 * Optimal for real-time graphics processing and video effects.
173 */
175
176 /**
177 * @brief High-performance audio processing with GPU acceleration
178 *
179 * Combines SAMPLE_RATE | GPU_PROCESS | PARALLEL for GPU-accelerated audio processing.
180 * This offloads audio processing to GPU hardware, typically using compute shaders
181 * for parallel execution. Useful for computationally intensive audio operations
182 * like convolution, FFT processing, or complex effects that benefit from GPU parallelization.
183 */
185
186 /**
187 * @brief Window event stream processing
188 *
189 * Processes window lifecycle events (resize, close, focus) and input events
190 * (keyboard, mouse) at frame rate using CPU in sequential order. This is
191 * distinct from graphics rendering - it handles the window container itself,
192 * not its visual content.
193 */
195
196 /**
197 * @brief Input device processing backend configuration
198 *
199 * Combines EVENT_RATE | CPU_PROCESS | SEQUENTIAL for input handling.
200 * Processes input from HID, MIDI, OSC, Serial backends on the CPU
201 * in sequential order as events arrive. Input is inherently event-driven
202 * and doesn't follow fixed sample/frame timing.
203 */
205
206 /**
207 * @brief Control data processing (LFOs, envelopes, modulation)
208 *
209 * Combines EVENT_RATE | CPU_PROCESS | PARALLEL for control signals.
210 * Control-rate data updates less frequently than audio but needs
211 * to be processed promptly when it changes.
212 */
214};
@ GPU_PROCESS
Executes processing operations on GPU hardware.
@ SAMPLE_RATE
Processes data at audio sample rate with buffer-sized chunks.
@ CPU_PROCESS
Executes processing operations on CPU threads.
@ AUDIO_BACKEND
Standard audio processing backend configuration.
@ PARALLEL
Processes operations in parallel when possible.
@ SEQUENTIAL
Processes operations sequentially, one after another.
@ EVENT_RATE
Processes data on event arrival (async/sporadic)
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
@ FRAME_RATE
Processes data at video frame rate.
@ WINDOW_EVENTS
Window event stream processing.
@ INPUT_BACKEND
Input device processing backend configuration.
@ CONTROL_DATA
Control data processing (LFOs, envelopes, modulation)
@ AUDIO_PARALLEL
High-performance parallel audio processing domain.
Definition Domain.hpp:43