MayaFlux 0.1.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 35 of file Chronie.cpp.

36{
37 auto scheduler = get_scheduler();
38 if (name.empty()) {
39 name = "metro_" + std::to_string(scheduler->get_next_task_id());
40 }
41 auto metronome = std::make_shared<Vruta::SoundRoutine>(create_metro(interval_seconds, std::move(callback)));
42
43 get_scheduler()->add_task(std::move(metronome), name, false);
44}
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler from the default engine.
Definition Chronie.cpp:14

References create_metro(), and get_scheduler().

+ Here is the call graph for this function: