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

◆ execute_phased()

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

Definition at line 99 of file BufferPipelineExecution.cpp.

100{
101 auto& promise = co_await Kriya::GetAudioPromise {};
102
103 if (m_operations.empty()) {
104 co_return;
105 }
106
108 uint32_t cycles_executed = 0;
109
110 while ((max_cycles == 0 || cycles_executed < max_cycles) && (m_continuous_execution || cycles_executed < max_cycles)) {
111
112 if (promise.should_terminate) {
113 break;
114 }
115
116 start_cycle();
118
119 for (size_t i = 0; i < m_operations.size(); ++i) {
120 auto& op = m_operations[i];
121
123 continue;
124 }
125
126 const uint32_t op_iterations = operation_iterations(op);
127
128 for (uint32_t iter = 0; iter < op_iterations; ++iter) {
131 co_await BufferDelay { 1 };
132 } else if (m_capture_timing == Vruta::DelayContext::SAMPLE_BASED && samples_per_operation > 0) {
133 co_await SampleDelay { samples_per_operation };
134 }
135 }
136
138 }
139
140 for (size_t i = 0; i < m_operations.size(); ++i) {
141 auto& op = m_operations[i];
142
144 continue;
145 }
146
148 continue;
149 }
150
151 if (!operation_due(op)) {
152 continue;
153 }
154
157
159 co_await BufferDelay { 1 };
160 } else if (m_process_timing == Vruta::DelayContext::SAMPLE_BASED && samples_per_operation > 0) {
161 co_await SampleDelay { samples_per_operation };
162 }
163 }
164
165 const auto synchronous_tasks = dispatch_cycle_branches(false);
166
167 while (any_active(synchronous_tasks)) {
169 co_await BufferDelay { 1 };
170 } else {
171 co_await SampleDelay { 1 };
172 }
173 }
174
175 finish_cycle();
176
178 cycles_executed++;
179 }
180
181 if (m_on_complete)
183}
static bool is_capture_phase_operation(const BufferOperation &op)
static bool is_process_phase_operation(const BufferOperation &op)
@ READY
Data ready for processing.
uint32_t operation_iterations(const BufferOperation &op) const
void process_operation(BufferOperation &op, uint64_t cycle)
std::vector< BufferOperation > m_operations
std::vector< DataState > m_data_states
static bool any_active(const std::vector< std::shared_ptr< Vruta::Routine > > &tasks)
std::function< void()> m_on_complete
bool operation_due(const BufferOperation &op) const
std::vector< std::shared_ptr< Vruta::Routine > > dispatch_cycle_branches(bool frame_rate)
GetPromiseBase< Vruta::audio_promise > GetAudioPromise
Audio domain promise accessor.
@ SAMPLE_BASED
Sample-accurate delay (audio domain)
@ BUFFER_BASED
Buffer-cycle delay (audio hardware boundary)

References any_active(), MayaFlux::Vruta::BUFFER_BASED, CONSUMED, dispatch_cycle_branches(), EMPTY, finish_cycle(), MayaFlux::Kriya::BufferOperation::is_capture_phase_operation(), MayaFlux::Kriya::BufferOperation::is_process_phase_operation(), m_capture_timing, m_continuous_execution, m_current_cycle, m_data_states, m_on_complete, m_operations, m_process_timing, operation_due(), operation_iterations(), process_operation(), READY, reset_cycle_state(), MayaFlux::Vruta::SAMPLE_BASED, and start_cycle().

Referenced by execute_internal(), execute_parallel(), and execute_reactive().

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