|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
High-level utility for scheduling one-shot timed callbacks. More...
#include <Timers.hpp>
Collaboration diagram for MayaFlux::Kriya::Timer:Public Member Functions | |
| Timer (Vruta::TaskScheduler &scheduler) | |
| Constructs a Timer with the specified scheduler. | |
| ~Timer ()=default | |
| void | schedule (double delay_seconds, std::function< void()> callback) |
| Schedules a callback to execute after a delay. | |
| void | cancel () |
| Cancels any scheduled callback. | |
| bool | is_active () const |
| Checks if a callback is currently scheduled. | |
Private Attributes | |
| Vruta::TaskScheduler & | m_Scheduler |
| Reference to the scheduler that manages this timer. | |
| std::shared_ptr< Vruta::SoundRoutine > | m_routine |
| The underlying computational routine that implements the timer. | |
| bool | m_active |
| Flag indicating whether a callback is currently scheduled. | |
| std::function< void()> | m_callback |
| The callback function to execute when the timer fires. | |
High-level utility for scheduling one-shot timed callbacks.
The Timer class provides a convenient way to schedule a function to execute after a specified delay. It wraps the lower-level computational routine system in a simple interface that's easier to use for common timing scenarios.
Unlike traditional timers which can drift due to system load, Timer uses the engine's sample-accurate clock to ensure precise, deterministic timing that's perfectly synchronized with the processing pipeline.
Example usage:
Only one callback can be scheduled at a time; scheduling a new callback cancels any previously scheduled callback.
Definition at line 38 of file Timers.hpp.