MayaFlux 0.4.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 43 of file Chronie.cpp.

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

References create_metro(), and get_scheduler().

+ Here is the call graph for this function: