791{
793
795 co_return;
796 }
797
799 uint32_t cycles_executed = 0;
800
801 while ((max_cycles == 0 || cycles_executed < max_cycles) && (
m_continuous_execution || cycles_executed < max_cycles)) {
802
803 if (promise.should_terminate) {
804 break;
805 }
806
809 }
810
814 }
815 }
816
818
819
820
821
824
826 continue;
827 }
828
831 continue;
832 }
833 }
834
836 continue;
837 }
838
839 uint32_t op_iterations = 1;
841 op_iterations = op.m_capture.get_cycle_count();
842 }
843
844 for (uint32_t iter = 0; iter < op_iterations; ++iter) {
847 co_await BufferDelay { 1 };
849 co_await SampleDelay { samples_per_operation };
850 }
851 }
852
854 }
855
856
857
858
859
862
864 continue;
865 }
866
868 continue;
869 }
870
873 continue;
874 }
875 }
876
878 continue;
879 }
880
883
885 co_await BufferDelay { 1 };
887 co_await SampleDelay { samples_per_operation };
888 }
889 }
890
891
892
893
894 std::vector<std::shared_ptr<Vruta::SoundRoutine>> current_cycle_sync_tasks;
895
899
900 if (branch.synchronous && task) {
901 current_cycle_sync_tasks.push_back(task);
902 }
903 }
904 }
905
906 if (!current_cycle_sync_tasks.empty()) {
907 bool any_active = true;
908 while (any_active) {
909 any_active = false;
910
911 for (auto& task : current_cycle_sync_tasks) {
912 if (task && task->is_active()) {
913 any_active = true;
914 break;
915 }
916 }
917
918 if (any_active) {
920 co_await BufferDelay { 1 };
921 } else {
922 co_await SampleDelay { 1 };
923 }
924 }
925 }
926 }
927
929
932 }
933
935
937 cycles_executed++;
938 }
939
942}
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)