|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Coroutine-based execution engine for composable, multi-strategy buffer processing. More...
#include <BufferPipeline.hpp>
Inheritance diagram for MayaFlux::Kriya::BufferPipeline:
Collaboration diagram for MayaFlux::Kriya::BufferPipeline:Classes | |
| struct | BranchInfo |
Public Member Functions | |
| BufferPipeline ()=default | |
| BufferPipeline (Vruta::TaskScheduler &scheduler, std::shared_ptr< Buffers::BufferManager > buffer_manager=nullptr) | |
| ~BufferPipeline () | |
| BufferPipeline & | operator>> (BufferOperation &&operation) |
| Chain an operation to the pipeline. | |
| BufferPipeline & | branch_if (std::function< bool(uint32_t)> condition, const std::function< void(BufferPipeline &)> &branch_builder, bool synchronous=false, uint64_t samples_per_operation=1) |
| Add conditional branch to the pipeline. | |
| BufferPipeline & | parallel (std::initializer_list< BufferOperation > operations) |
| Execute operations in parallel within the current cycle. | |
| BufferPipeline & | with_lifecycle (std::function< void(uint32_t)> on_cycle_start, std::function< void(uint32_t)> on_cycle_end) |
| Set lifecycle callbacks for cycle management. | |
| BufferPipeline & | with_strategy (ExecutionStrategy strategy) |
| Set the execution strategy for this pipeline. | |
| BufferPipeline & | capture_timing (Vruta::DelayContext mode) |
| Set timing mode for capture phase. | |
| BufferPipeline & | process_timing (Vruta::DelayContext mode) |
| Set timing mode for process phase. | |
| ExecutionStrategy | get_strategy () const |
| Get current execution strategy. | |
| void | execute_buffer_rate (uint64_t max_cycles=0) |
| Execute pipeline synchronized to audio hardware cycle boundaries. | |
| void | execute_once () |
| Execute the pipeline for a single cycle. | |
| void | execute_for_cycles (uint64_t cycles=0) |
| Execute the pipeline for a specified number of cycles. | |
| void | execute_continuous () |
| Start continuous execution of the pipeline. | |
| void | stop_continuous () |
| Stop continuous execution of the pipeline. | |
| void | execute_scheduled (uint64_t max_cycles=0, uint64_t samples_per_operation=1) |
| Execute pipeline with sample-accurate timing between operations. | |
| void | execute_scheduled_at_rate (uint32_t max_cycles=0, double seconds_per_operation=1) |
| Execute pipeline with real-time rate control. | |
| void | mark_data_consumed (uint32_t operation_index) |
| Execute pipeline synchronized to audio hardware cycle boundaries. | |
| bool | has_pending_data () const |
| Check if any operations have pending data ready for processing. | |
| uint32_t | get_current_cycle () const |
| Get the current cycle number. | |
Static Public Member Functions | |
| static std::shared_ptr< BufferPipeline > | create (Vruta::TaskScheduler &scheduler, std::shared_ptr< Buffers::BufferManager > buffer_manager=nullptr) |
Private Types | |
| enum class | DataState : uint8_t { EMPTY , READY , CONSUMED , EXPIRED } |
Private Member Functions | |
| void | capture_operation (BufferOperation &op, uint64_t cycle) |
| void | reset_accumulated_data () |
| bool | has_immediate_routing (const BufferOperation &op) const |
| void | process_operation (BufferOperation &op, uint64_t cycle) |
| std::shared_ptr< Vruta::SoundRoutine > | dispatch_branch_async (BranchInfo &branch, uint64_t cycle) |
| void | await_timing (Vruta::DelayContext mode, uint64_t units) |
| void | cleanup_expired_data () |
| void | cleanup_completed_branches () |
| Vruta::SoundRoutine | execute_internal (uint64_t max_cycles, uint64_t samples_per_operation) |
| Vruta::SoundRoutine | execute_phased (uint64_t max_cycles, uint64_t samples_per_operation) |
| Vruta::SoundRoutine | execute_streaming (uint64_t max_cycles, uint64_t samples_per_operation) |
| Vruta::SoundRoutine | execute_parallel (uint64_t max_cycles, uint64_t samples_per_operation) |
| Vruta::SoundRoutine | execute_reactive (uint64_t max_cycles, uint64_t samples_per_operation) |
| void | execute_capture_phase (uint64_t cycle_base) |
| void | execute_process_phase (uint64_t cycle) |
Static Private Member Functions | |
| static Kakshya::DataVariant | extract_buffer_data (const std::shared_ptr< Buffers::AudioBuffer > &buffer, bool should_process=false) |
| static void | write_to_buffer (const std::shared_ptr< Buffers::AudioBuffer > &buffer, const Kakshya::DataVariant &data) |
| static void | write_to_container (const std::shared_ptr< Kakshya::DynamicSoundStream > &container, const Kakshya::DataVariant &data) |
| static Kakshya::DataVariant | read_from_container (const std::shared_ptr< Kakshya::DynamicSoundStream > &container, uint64_t start, uint32_t length) |
Private Attributes | |
| std::shared_ptr< BufferPipeline > | m_active_self |
| std::shared_ptr< CycleCoordinator > | m_coordinator |
| std::shared_ptr< Buffers::BufferManager > | m_buffer_manager |
| Vruta::TaskScheduler * | m_scheduler = nullptr |
| std::vector< BufferOperation > | m_operations |
| std::vector< DataState > | m_data_states |
| std::unordered_map< BufferOperation *, Kakshya::DataVariant > | m_operation_data |
| std::vector< BranchInfo > | m_branches |
| std::vector< std::shared_ptr< Vruta::SoundRoutine > > | m_branch_tasks |
| std::function< void(uint32_t)> | m_cycle_start_callback |
| std::function< void(uint32_t)> | m_cycle_end_callback |
| uint64_t | m_current_cycle { 0 } |
| uint64_t | m_max_cycles { 0 } |
| bool | m_continuous_execution { false } |
| ExecutionStrategy | m_execution_strategy { ExecutionStrategy::PHASED } |
| Vruta::DelayContext | m_capture_timing { Vruta::DelayContext::BUFFER_BASED } |
| Vruta::DelayContext | m_process_timing { Vruta::DelayContext::SAMPLE_BASED } |
Coroutine-based execution engine for composable, multi-strategy buffer processing.
BufferPipeline provides a flexible framework for orchestrating complex data flow patterns through declarative operation chains. It supports multiple execution strategies (phased, streaming, parallel, reactive), sophisticated data accumulation modes, and sample-accurate timing coordination via the coroutine scheduler.
Core Concepts:
Simple Capture & Route:
Accumulation & Batch Processing (PHASED strategy):
Real-Time Streaming Modification (STREAMING strategy):
Circular Buffer for Rolling Analysis:
Windowed Capture with Overlap:
Multi-Source Fusion:
Conditional Branching:
Per-Iteration Routing (Immediate Routing):
Lifecycle Callbacks:
Execution Modes:
execute_buffer_rate(N): Synchronized to audio buffer boundaries for N cyclesexecute_continuous(): Runs indefinitely until stoppedexecute_for_cycles(N): Runs exactly N cycles then stopsexecute_once(): Single cycle executionexecute_scheduled(N, samples): With sample-accurate delays between operationsStrategy Selection:
Definition at line 168 of file BufferPipeline.hpp.