24template <
typename... Args>
35void schedule_metro(
double interval_seconds, std::function<
void()> callback, std::string name)
39 name =
"metro_" + std::to_string(scheduler->get_next_task_id());
41 auto metronome = std::make_shared<Vruta::SoundRoutine>(
create_metro(interval_seconds, std::move(callback)));
51void schedule_sequence(std::vector<std::pair<
double, std::function<
void()>>> seq, std::string name)
55 name =
"seq_" + std::to_string(scheduler->get_next_task_id());
57 auto tseq = std::make_shared<Vruta::SoundRoutine>(
create_sequence(std::move(seq)));
71void schedule_pattern(std::function<std::any(uint64_t)> pattern_func, std::function<
void(std::any)> callback,
double interval_seconds, std::string name)
75 name =
"pattern_" + std::to_string(scheduler->get_next_task_id());
77 auto pattern = std::make_shared<Vruta::SoundRoutine>(
create_pattern(std::move(pattern_func), std::move(callback), interval_seconds));
84 auto cur_val = task->get_state<
float>(
"current_value");
98 auto task_ptr = std::make_shared<Vruta::SoundRoutine>(task);
114 return { std::move(node) };
124 return { std::move(func) };
#define MF_ERROR(comp, ctx,...)
Core engine lifecycle and configuration API.
std::shared_ptr< Vruta::EventManager > get_event_manager()
Gets the event manager.
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler.
A token representing an action in a computational sequence.
static std::shared_ptr< BufferPipeline > create(Vruta::TaskScheduler &scheduler, std::shared_ptr< Buffers::BufferManager > buffer_manager=nullptr)
A C++20 coroutine-based audio processing task with sample-accurate timing.
@ CoroutineScheduling
Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
@ API
MayaFlux/API Wrapper and convenience functions.
Vruta::SoundRoutine sequence(Vruta::TaskScheduler &scheduler, std::vector< std::pair< double, std::function< void()> > > sequence)
Creates a temporal sequence that executes callbacks at specified time offsets.
Vruta::SoundRoutine pattern(Vruta::TaskScheduler &scheduler, std::function< std::any(uint64_t)> pattern_func, std::function< void(std::any)> callback, double interval_seconds)
Creates a generative algorithm that produces values based on a pattern function.
Vruta::SoundRoutine line(Vruta::TaskScheduler &scheduler, float start_value, float end_value, float duration_seconds, uint32_t step_duration, bool restartable)
Creates a continuous interpolation generator between two values over time.
Vruta::SoundRoutine metro(Vruta::TaskScheduler &scheduler, double interval_seconds, std::function< void()> callback)
Creates a periodic event generator that executes a callback at regular intervals.
bool update_task_params(const std::string &name, Args... args)
Updates parameters of a scheduled task.
void 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.
std::shared_ptr< Vruta::EventManager > get_event_manager()
Gets the event manager from the default engine.
bool restart_task(const std::string &name)
Restarts a scheduled task.
Vruta::SoundRoutine create_pattern(std::function< std::any(uint64_t)> pattern_func, std::function< void(std::any)> callback, double interval_seconds)
Schedules a pattern generator that produces values based on a pattern function.
void schedule_sequence(std::vector< std::pair< double, std::function< void()> > > seq, std::string name)
Creates a sequence task that calls functions at specified times and addes it to the default scheduler...
Vruta::SoundRoutine create_line(float start_value, float end_value, float duration_seconds, uint32_t step_duration, bool loop)
Creates a line generator that interpolates between values over time.
Kriya::ActionToken Play(std::shared_ptr< Nodes::Node > node)
Creates an action to play a node.
void schedule_task(const std::string &name, Vruta::SoundRoutine &&task, bool initialize)
Schedules a new sound routine task.
void 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 de...
float * get_line_value(const std::string &name)
Gets a pointer to a task's current value.
Kriya::ActionToken Action(std::function< void()> func)
Creates a custom action.
Vruta::SoundRoutine create_metro(double interval_seconds, std::function< void()> callback)
Creates a simple task that calls a function at a specified interval.
std::shared_ptr< Kriya::BufferPipeline > create_buffer_pipeline()
Creates a new buffer pipeline instance.
std::shared_ptr< Buffers::BufferManager > get_buffer_manager()
Gets the buffer manager from the default engine.
bool cancel_task(const std::string &name)
Cancels a scheduled task.
Core::Engine & get_context()
Gets the default engine instance.
Vruta::SoundRoutine create_sequence(std::vector< std::pair< double, std::function< void()> > > seq)
Creates a sequence task that calls functions at specified times.
Kriya::ActionToken Wait(double seconds)
Creates a wait action.
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler from the default engine.
Main namespace for the Maya Flux audio engine.