MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ schedule_metro()

MAYAFLUX_API void MayaFlux::schedule_metro ( double  interval_seconds,
std::function< void()>  callback,
std::string  name = "" 
)

Creates a metronome task and addes it to the default scheduler list for evaluation.

Parameters
interval_secondsTime between calls in seconds
callbackFunction to call on each tick
nameName of the metronome task (optional but recommended). If not provided, a default name will be generated.

Uses the task scheduler from the default engine.

Definition at line 41 of file Chronie.cpp.

42{
43 auto scheduler = get_scheduler();
44 if (name.empty()) {
45 name = "metro_" + std::to_string(scheduler->get_next_task_id());
46 }
47 auto metronome = std::make_shared<Vruta::SoundRoutine>(create_metro(interval_seconds, std::move(callback)));
48
49 get_scheduler()->add_task(std::move(metronome), name, false);
50}
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler from the default engine.
Definition Chronie.cpp:20

References create_metro(), and get_scheduler().

+ Here is the call graph for this function: