MayaFlux 0.1.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 6 of file Awaiters.cpp.

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

References MayaFlux::Vruta::SAMPLE_BASED.