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

◆ schedule_pattern()

MAYAFLUX_API void MayaFlux::schedule_pattern ( std::function< std::any(uint64_t)>  pattern_func,
std::function< void(std::any)>  callback,
double  interval_seconds,
std::string  name = "" 
)

Schedules a pattern generator that produces values based on a pattern function and addes it to the default scheduler list for evaluation.

Parameters
pattern_funcFunction that generates pattern values based on step index
callbackFunction to call with each pattern value
interval_secondsTime between pattern steps
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 71 of file Chronie.cpp.

72{
73 auto scheduler = get_scheduler();
74 if (name.empty()) {
75 name = "pattern_" + std::to_string(scheduler->get_next_task_id());
76 }
77 auto pattern = std::make_shared<Vruta::SoundRoutine>(create_pattern(std::move(pattern_func), std::move(callback), interval_seconds));
78 get_scheduler()->add_task(std::move(pattern), name, false);
79}
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler from the default engine.
Definition Chronie.cpp:14

References create_pattern(), and get_scheduler().

+ Here is the call graph for this function: