MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kriya::SampleDelay Struct Reference

Awaitable object for precise sample-accurate timing delays. More...

#include <Awaiters.hpp>

+ Collaboration diagram for MayaFlux::Kriya::SampleDelay:

Public Types

using promise_handle = Vruta::audio_promise
 Type alias for the coroutine promise type.
 

Public Member Functions

 SampleDelay (uint64_t samples)
 
bool await_ready () const
 Checks if the delay should be bypassed.
 
void await_resume ()
 Called when the coroutine is resumed after the delay.
 
void await_suspend (std::coroutine_handle< promise_handle > h) noexcept
 Schedules the coroutine to resume after the delay.
 

Public Attributes

uint64_t samples_to_wait
 Number of time units to wait before resuming the coroutine.
 

Detailed Description

Awaitable object for precise sample-accurate timing delays.

SampleDelay is the primary timing mechanism in the computational coroutine system. When a coroutine co_awaits a SampleDelay, it suspends execution until exactly the specified number of discrete time units (samples) have been processed.

This provides deterministic timing for computational events, which is essential for applications where precise temporal relationships are critical. Unlike system-time-based delays which can drift due to processing load, SampleDelay guarantees that operations occur at exact positions in the discrete time continuum.

Example usage:

// Wait for exactly 4410 time units (100ms at 44.1kHz sample rate)
co_await SampleDelay{4410};
Awaitable object for precise sample-accurate timing delays.
Definition Awaiters.hpp:35

SampleDelay is the foundation for all timing in the computational engine, enabling precise sequencing, modulation, and synchronization of events across multiple domains (signal processing, visual rendering, data transformation, physical modeling, etc.).

Definition at line 35 of file Awaiters.hpp.


The documentation for this struct was generated from the following files: