777{
779
781 co_return;
782 }
783
785 uint32_t cycles_executed = 0;
786
787 while ((max_cycles == 0 || cycles_executed < max_cycles) && (
m_continuous_execution || cycles_executed < max_cycles)) {
788
789 if (promise.should_terminate) {
790 break;
791 }
792
795 }
796
800 }
801 }
802
804
805
806
807
810
812 continue;
813 }
814
817 continue;
818 }
819 }
820
822 continue;
823 }
824
825 uint32_t op_iterations = 1;
827 op_iterations = op.m_capture.get_cycle_count();
828 }
829
830 for (uint32_t iter = 0; iter < op_iterations; ++iter) {
833 co_await BufferDelay { 1 };
835 co_await SampleDelay { samples_per_operation };
836 }
837 }
838
840 }
841
842
843
844
845
848
850 continue;
851 }
852
854 continue;
855 }
856
859 continue;
860 }
861 }
862
864 continue;
865 }
866
869
871 co_await BufferDelay { 1 };
873 co_await SampleDelay { samples_per_operation };
874 }
875 }
876
877
878
879
880 std::vector<std::shared_ptr<Vruta::SoundRoutine>> current_cycle_sync_tasks;
881
885
886 if (branch.synchronous && task) {
887 current_cycle_sync_tasks.push_back(task);
888 }
889 }
890 }
891
892 if (!current_cycle_sync_tasks.empty()) {
893 bool any_active = true;
894 while (any_active) {
895 any_active = false;
896
897 for (auto& task : current_cycle_sync_tasks) {
898 if (task && task->is_active()) {
899 any_active = true;
900 break;
901 }
902 }
903
904 if (any_active) {
906 co_await BufferDelay { 1 };
907 } else {
908 co_await SampleDelay { 1 };
909 }
910 }
911 }
912 }
913
915
918 }
919
921
923 cycles_executed++;
924 }
925
928}
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::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.
@ SAMPLE_BASED
Sample-accurate delay (audio domain)
@ BUFFER_BASED
Buffer-cycle delay (audio hardware boundary)