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;
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.");
24 if constexpr (std::is_same_v<promise_handle, Vruta::graphics_promise>
25 || std::is_same_v<promise_handle, Vruta::complex_promise>) {
26 if constexpr (
requires { h.promise().next_frame; }) {
27 h.promise().next_frame += frames_to_wait;
31 if constexpr (
requires { h.promise().domain_mismatch_error(
"",
""); }) {
32 h.promise().domain_mismatch_error(
"FrameDelay",
33 "This awaitable is not compatible with the current coroutine promise type.");
40 if constexpr (
requires { h.promise().next_sample; }) {
41 h.promise().next_sample += samples_to_wait;
43 if constexpr (
requires { h.promise().next_frame; }) {
44 h.promise().next_frame += frames_to_wait;
void try_resume()
Called by EventSource when event arrives.
std::coroutine_handle m_handle
Vruta::EventSource & m_source
void await_suspend(std::coroutine_handle<> handle)
Suspend coroutine, register for event notification.
std::optional< Core::WindowEventType > m_filter
Core::WindowEvent await_resume()
Resume with event data.
Core::WindowEvent m_result
bool await_ready()
Check if event already available.
std::optional< Core::WindowEvent > pop_event(std::optional< Core::WindowEventType > filter)
void register_waiter(Kriya::EventAwaiter *awaiter)
void unregister_waiter(Kriya::EventAwaiter *awaiter)
@ FRAME_BASED
Frame-rate delay (Graphics domain)
@ SAMPLE_BASED
Sample-accurate delay (audio domain)
Event data for window and input events.
void await_suspend(std::coroutine_handle< Vruta::graphics_promise > h) noexcept
void await_suspend(std::coroutine_handle< Vruta::complex_promise > h) noexcept
void await_suspend(std::coroutine_handle< promise_handle > h) noexcept
Schedules the coroutine to resume after the delay.