|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
| MAYAFLUX_API std::shared_ptr< Vruta::Routine > MayaFlux::Kriya::metro | ( | double | interval_seconds, |
| std::function< void()> | callback, | ||
| Vruta::ProcessingToken | token = Vruta::ProcessingToken::SAMPLE_ACCURATE |
||
| ) |
Creates a periodic event generator that executes a callback at regular intervals.
| interval_seconds | Time between callback executions in seconds |
| callback | Function to execute on each interval |
| token | Processing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE) |
The metro task provides a fundamental temporal mechanism for creating time-based structures in computational systems. It executes the provided callback function at precise, regular intervals with sample-accurate timing, enabling the creation of rhythmic patterns, event sequences, and temporal frameworks that can synchronize across different domains.
Unlike system timers which can drift due to processing load, this implementation maintains precise timing by synchronizing with the sample-rate clock, making it suitable for both audio and cross-domain applications where timing accuracy is critical.
Example usage:
The metro task continues indefinitely until explicitly cancelled, creating a persistent temporal structure within the computational system.
Definition at line 12 of file Tasks.cpp.
References MayaFlux::Vruta::FRAME_ACCURATE, MayaFlux::Kriya::FrameDelay::frames_to_wait, MayaFlux::Vruta::seconds_to_frames(), and MayaFlux::Vruta::seconds_to_samples().
Referenced by MayaFlux::Nexus::Wiring::finalise(), and MayaFlux::schedule_metro().
Here is the call graph for this function:
Here is the caller graph for this function: