MayaFlux 0.4.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 930 of file BufferPipeline.cpp.

931{
932 auto& promise = co_await Kriya::GetAudioPromise {};
933
934 if (m_operations.empty()) {
935 co_return;
936 }
937
939 uint32_t cycles_executed = 0;
940
941 while ((max_cycles == 0 || cycles_executed < max_cycles) && (m_continuous_execution || cycles_executed < max_cycles)) {
942
943 if (promise.should_terminate) {
944 break;
945 }
946
949 }
950
951 for (size_t i = 0; i < m_operations.size(); ++i) {
952 auto& op = m_operations[i];
953
954 if (op.get_type() == BufferOperation::OpType::CONDITION) {
955 if (!op.m_condition || !op.m_condition(m_current_cycle)) {
956 continue;
957 }
958 }
959
960 if (m_current_cycle % op.m_cycle_interval != 0) {
961 continue;
962 }
963
964 uint32_t op_iterations = 1;
965 if (op.get_type() == BufferOperation::OpType::CAPTURE) {
966 op_iterations = op.m_capture.get_cycle_count();
967 }
968
969 for (uint32_t iter = 0; iter < op_iterations; ++iter) {
970
973
974 for (size_t j = i + 1; j < m_operations.size(); ++j) {
975 auto& dependent_op = m_operations[j];
976
978 process_operation(dependent_op, m_current_cycle + iter);
980 }
981
982 break;
983 }
984
986 co_await BufferDelay { 1 };
987 } else if (samples_per_operation > 0) {
988 co_await SampleDelay { samples_per_operation };
989 }
990 }
991 }
992
993 for (auto& branch : m_branches) {
994 if (branch.condition(m_current_cycle)) {
996 }
997 }
998
1000
1003 }
1004
1006
1008 cycles_executed++;
1009 }
1010
1011 if (m_on_complete)
1012 m_on_complete();
1013}
@ 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::function< void()> m_on_complete
std::shared_ptr< Vruta::SoundRoutine > dispatch_branch_async(BranchInfo &branch, uint64_t cycle)
GetPromiseBase< Vruta::audio_promise > GetAudioPromise
Audio domain promise accessor.
@ 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_on_complete, 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: