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

◆ await_suspend()

void MayaFlux::Kriya::SampleDelay::await_suspend ( std::coroutine_handle< promise_handle h)
noexcept

Schedules the coroutine to resume after the delay.

Parameters
hHandle to the suspended coroutine

This method is called when the coroutine suspends. It updates the coroutine's next_sample field to schedule it for resumption after the specified number of time units have been processed.

Definition at line 5 of file DelayAwaiters.cpp.

6{
7 if constexpr (std::is_same_v<promise_handle, Vruta::audio_promise>
8 || std::is_same_v<promise_handle, Vruta::complex_promise>) {
9 if constexpr (requires { h.promise().next_sample; }) {
10 h.promise().next_sample += samples_to_wait;
11 h.promise().active_delay_context = Vruta::DelayContext::SAMPLE_BASED;
12 }
13 } else {
14 if constexpr (requires { h.promise().domain_mismatch_error("", ""); }) {
15 h.promise().domain_mismatch_error("SampleDelay",
16 "This awaitable is not compatible with the current coroutine promise type.");
17 }
18 }
19}
@ SAMPLE_BASED
Sample-accurate delay (audio domain)
uint64_t samples_to_wait
Number of time units to wait before resuming the coroutine.

References MayaFlux::Vruta::SAMPLE_BASED.