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

◆ schedule_pattern() [3/4]

template<std::incrementable Index = uint64_t, typename Values, typename Callback, typename Durations = std::vector<double>>
requires Kriya::PatternValues<Values, Index> && Kriya::PatternCallback<Callback, Kriya::pattern_value_t<Values, Index>> && Kriya::PatternDurations<Durations>
void MayaFlux::schedule_pattern ( Values values,
Callback callback,
Durations durations,
std::function< void()> on_complete,
std::string name = "",
Vruta::ProcessingToken token = Vruta::ProcessingToken::SAMPLE_ACCURATE )

Schedules a typed pattern spaced by durations and runs a function when it is done.

Template Parameters
IndexStep index type, default uint64_t
Parameters
valuesCallable from the step index to any value, a range played once, or recurring(range)
callbackCallable that takes the generated value, or the range element by reference
durationsA list of seconds, a TimeMap, or a callable from a pass number to a range of seconds
on_completeCalled once when the pattern ends or is cancelled, or when a task of the same name replaces it
nameName of the pattern task (optional but recommended)
tokenProcessing token to determine which scheduler rate to use (default: SAMPLE_ACCURATE)

The function is registered before the pattern is scheduled. A range ends the pattern after its last element and that step's wait. It runs on the thread that finishes the routine, the audio thread for the default token, so keep it short. It may schedule or cancel tasks; those take effect on the next drain.

schedule_pattern(phrase, play, { 0.25 }, [] { schedule_pattern(next_phrase, play, { 0.25 }); }, "intro");
void schedule_pattern(std::function< std::any(uint64_t)> pattern_func, std::function< void(std::any)> callback, std::vector< double > durations, std::string name, Vruta::ProcessingToken token)
Schedules a pattern generator whose steps are spaced by a list of durations.
Definition Chronie.cpp:78

Definition at line 189 of file Chronie.hpp.

190{
191 auto routine = Kriya::pattern<Index>(std::move(values), std::move(callback), std::move(durations), token);
192 if (routine && on_complete) {
193 routine->on_complete(std::move(on_complete));
194 }
195 schedule_task(name, routine);
196}
std::shared_ptr< Vruta::Routine > pattern(std::function< std::any(uint64_t)> pattern_func, std::function< void(std::any)> callback, std::function< bool(uint64_t)> ready, Vruta::ProcessingToken token)
The std::any, uint64_t form of the condition driven pattern.
Definition Pattern.cpp:5
void schedule_task(const std::string &name, Vruta::SoundRoutine &&task, bool initialize)
Schedules a new sound routine task.
Definition Chronie.cpp:103

References MayaFlux::Kriya::pattern(), MayaFlux::Vruta::SAMPLE_ACCURATE, and schedule_task().

Here is the call graph for this function: