MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
BufferSpec.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace MayaFlux::Buffers {
4
5class Buffer;
6class VKBuffer;
7class AudioBuffer;
8
9/**
10 * @brief Audio processing function - receives correctly-typed AudioBuffer
11 *
12 * User writes:
13 * @code
14 * auto processor = [](const std::shared_ptr<AudioBuffer>& buf) {
15 * auto& data = buf->get_data();
16 * for (auto& sample : data) sample *= 0.5;
17 * };
18 *
19 * buffer_manager->attach_processor(processor, audio_buffer, AUDIO_BACKEND);
20 * buffer_manager->attach_processor_to_channel(processor, AUDIO_BACKEND, 0);
21 * buffer_manager->attach_processor_to_token(processor, AUDIO_BACKEND);
22 * @endcode
23 *
24 * No casting needed - it's already AudioBuffer!
25 */
26using AudioProcessingFunction = std::function<void(const std::shared_ptr<AudioBuffer>&)>;
27
28/**
29 * @brief Graphics processing function - receives correctly-typed VKBuffer
30 *
31 * User writes:
32 * @code
33 * auto processor = [](const std::shared_ptr<VKBuffer>& buf) {
34 * // buf is already VKBuffer, no casting
35 * };
36 *
37 * buffer_manager->attach_processor(processor, graphics_buffer, GRAPHICS_BACKEND);
38 * buffer_manager->attach_processor_to_channel(processor, GRAPHICS_BACKEND, 0);
39 * buffer_manager->attach_processor_to_token(processor, GRAPHICS_BACKEND);
40 * @endcode
41 *
42 * No casting needed - it's already VKBuffer!
43 */
44using GraphicsProcessingFunction = std::function<void(const std::shared_ptr<VKBuffer>&)>;
45
46// ============================================================================
47// Variant Type for Unified Dispatcher
48// ============================================================================
49
50using BufferProcessingFunction = std::variant<AudioProcessingFunction, GraphicsProcessingFunction>;
51}
std::function< void(const std::shared_ptr< AudioBuffer > &)> AudioProcessingFunction
Audio processing function - receives correctly-typed AudioBuffer.
std::variant< AudioProcessingFunction, GraphicsProcessingFunction > BufferProcessingFunction
std::function< void(const std::shared_ptr< VKBuffer > &)> GraphicsProcessingFunction
Graphics processing function - receives correctly-typed VKBuffer.