|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
| std::shared_ptr< Vruta::Routine > MayaFlux::Kriya::pattern | ( | Generator | generator, |
| Callback | callback, | ||
| Condition | ready, | ||
| Vruta::ProcessingToken | token = Vruta::ProcessingToken::SAMPLE_ACCURATE |
||
| ) |
Creates a pattern whose next step runs when a condition holds.
| Index | Step index type, default uint64_t |
| generator | Callable from the step index to any value |
| callback | Callable that takes the generated value |
| ready | Condition for the step index, checked each time the routine resumes |
| token | Selects the routine type that runs the pattern |
The routine suspends and checks ready(index) again until it holds, then runs callback(generator(index)) and advances the index. The value type is whatever the generator returns, so no cast is involved. The condition can be anything that returns a bool: a Logic node's output, a flag, another routine's state. A condition that stays true runs one step per check.
Tokens:
A function that throws is logged and ends the pattern.