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

◆ execute_streaming()

Vruta::SoundRoutine MayaFlux::Kriya::BufferPipeline::execute_streaming ( uint64_t  max_cycles,
uint64_t  samples_per_operation 
)
private

Definition at line 884 of file BufferPipeline.cpp.

885{
886 auto& promise = co_await Kriya::GetAudioPromise {};
887
888 if (m_operations.empty()) {
889 co_return;
890 }
891
893 uint32_t cycles_executed = 0;
894
895 while ((max_cycles == 0 || cycles_executed < max_cycles) && (m_continuous_execution || cycles_executed < max_cycles)) {
896
897 if (promise.should_terminate) {
898 break;
899 }
900
903 }
904
905 for (size_t i = 0; i < m_operations.size(); ++i) {
906 auto& op = m_operations[i];
907
908 if (op.get_type() == BufferOperation::OpType::CONDITION) {
909 if (!op.m_condition || !op.m_condition(m_current_cycle)) {
910 continue;
911 }
912 }
913
914 if (m_current_cycle % op.m_cycle_interval != 0) {
915 continue;
916 }
917
918 uint32_t op_iterations = 1;
919 if (op.get_type() == BufferOperation::OpType::CAPTURE) {
920 op_iterations = op.m_capture.get_cycle_count();
921 }
922
923 for (uint32_t iter = 0; iter < op_iterations; ++iter) {
924
927
928 for (size_t j = i + 1; j < m_operations.size(); ++j) {
929 auto& dependent_op = m_operations[j];
930
932 process_operation(dependent_op, m_current_cycle + iter);
934 }
935
936 break;
937 }
938
940 co_await BufferDelay { 1 };
941 } else if (samples_per_operation > 0) {
942 co_await SampleDelay { samples_per_operation };
943 }
944 }
945 }
946
947 for (auto& branch : m_branches) {
948 if (branch.condition(m_current_cycle)) {
950 }
951 }
952
954
957 }
958
960
962 cycles_executed++;
963 }
964}
@ CONDITION
Conditional operation for branching logic.
@ CAPTURE
Capture data from source buffer using BufferCapture strategy.
static bool is_process_phase_operation(const BufferOperation &op)
@ READY
Data ready for processing.
void process_operation(BufferOperation &op, uint64_t cycle)
std::vector< BranchInfo > m_branches
std::vector< BufferOperation > m_operations
std::vector< DataState > m_data_states
std::function< void(uint32_t)> m_cycle_end_callback
std::function< void(uint32_t)> m_cycle_start_callback
std::shared_ptr< Vruta::SoundRoutine > dispatch_branch_async(BranchInfo &branch, uint64_t cycle)
GetPromiseBase< Vruta::audio_promise > GetAudioPromise
Audio domain promise accessor.
Definition Awaiters.hpp:231
@ BUFFER_BASED
Buffer-cycle delay (audio hardware boundary)

References MayaFlux::Vruta::BUFFER_BASED, MayaFlux::Kriya::BufferOperation::CAPTURE, cleanup_completed_branches(), cleanup_expired_data(), MayaFlux::Kriya::BufferOperation::CONDITION, dispatch_branch_async(), EMPTY, MayaFlux::Kriya::BufferOperation::is_process_phase_operation(), m_branches, m_capture_timing, m_continuous_execution, m_current_cycle, m_cycle_end_callback, m_cycle_start_callback, m_data_states, m_operations, process_operation(), and READY.

Referenced by execute_internal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: