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

◆ pattern() [2/4]

template<std::incrementable Index = uint64_t, typename Generator , typename Callback , typename Source >
requires PatternGenerator<Generator, Index> && PatternCallback<Callback, typename PatternTraits<Generator, Index>::value_type> && PatternDurationSource<Source>
std::shared_ptr< Vruta::Routine > MayaFlux::Kriya::pattern ( Generator  generator,
Callback  callback,
Source  durations,
Vruta::ProcessingToken  token = Vruta::ProcessingToken::SAMPLE_ACCURATE 
)

Creates a pattern whose durations come from a function that returns an array per pass.

Template Parameters
IndexStep index type, default uint64_t
Parameters
generatorCallable from the step index to any value
callbackCallable that takes the generated value
durationsCallable from a pass number to a range of seconds
tokenSelects the routine type that runs the pattern
Returns
The routine, or nullptr for an empty function or an unsupported token

The function is called with 0 for the first pass and again, with the next number, each time the array it returned has been used up. Durations are stepped through one per step. An empty array, or a throw from the function, ends the pattern after the step that asked for it. This lets the gaps change from pass to pass.

auto routine = Kriya::pattern(generate, apply, [](uint64_t pass) -> std::vector<double> {
if (pass > 3) return {};
return { 0.25, 0.25 * (pass + 1) };
});
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