734{
736
738 co_return;
739 }
740
742 uint32_t cycles_executed = 0;
743
744 while ((max_cycles == 0 || cycles_executed < max_cycles) && (
m_continuous_execution || cycles_executed < max_cycles)) {
745
746 if (promise.should_terminate) {
747 break;
748 }
749
752 }
753
757 }
758 }
759
761
762
763
764
767
769 continue;
770 }
771
774 continue;
775 }
776 }
777
779 continue;
780 }
781
782 uint32_t op_iterations = 1;
784 op_iterations = op.m_capture.get_cycle_count();
785 }
786
787 for (uint32_t iter = 0; iter < op_iterations; ++iter) {
790 co_await BufferDelay { 1 };
792 co_await SampleDelay { samples_per_operation };
793 }
794 }
795
797 }
798
799
800
801
802
805
807 continue;
808 }
809
811 continue;
812 }
813
816 continue;
817 }
818 }
819
821 continue;
822 }
823
826
828 co_await BufferDelay { 1 };
830 co_await SampleDelay { samples_per_operation };
831 }
832 }
833
834
835
836
837 std::vector<std::shared_ptr<Vruta::SoundRoutine>> current_cycle_sync_tasks;
838
842
843 if (branch.synchronous && task) {
844 current_cycle_sync_tasks.push_back(task);
845 }
846 }
847 }
848
849 if (!current_cycle_sync_tasks.empty()) {
850 bool any_active = true;
851 while (any_active) {
852 any_active = false;
853
854 for (auto& task : current_cycle_sync_tasks) {
855 if (task && task->is_active()) {
856 any_active = true;
857 break;
858 }
859 }
860
861 if (any_active) {
863 co_await BufferDelay { 1 };
864 } else {
865 co_await SampleDelay { 1 };
866 }
867 }
868 }
869 }
870
872
875 }
876
878
880 cycles_executed++;
881 }
882}
static bool is_capture_phase_operation(const BufferOperation &op)
@ 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.
@ CONSUMED
Data has been processed.
@ EMPTY
No data available.
Vruta::DelayContext m_process_timing
void cleanup_completed_branches()
void process_operation(BufferOperation &op, uint64_t cycle)
void reset_accumulated_data()
Vruta::DelayContext m_capture_timing
std::vector< BranchInfo > m_branches
std::vector< BufferOperation > m_operations
std::vector< DataState > m_data_states
void cleanup_expired_data()
std::function< void(uint32_t)> m_cycle_end_callback
bool m_continuous_execution
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.
@ SAMPLE_BASED
Sample-accurate delay (audio domain)
@ BUFFER_BASED
Buffer-cycle delay (audio hardware boundary)