18 : m_Scheduler(scheduler)
24 m_events.push_back({ std::move(action), delay_seconds });
33 auto shared_this = std::make_shared<EventChain>(*
this);
36 for (
const auto& event : chain->m_events) {
42 }
catch (
const std::exception& e) {
43 std::cerr <<
"Exception in EventChain action: " << e.what() <<
'\n';
45 std::cerr <<
"Unknown exception in EventChain action" <<
'\n';
55 : type(Utils::ActionType::NODE)
56 , node(
std::move(_node))
61 : type(Utils::ActionType::TIME)
67 : type(Utils::ActionType::FUNCTION)
68 , func(
std::move(_func))
83void Sequence::execute(
const std::shared_ptr<Nodes::NodeGraphManager>& node_manager,
const std::shared_ptr<Vruta::TaskScheduler>& scheduler)
86 double accumulated_time = 0.F;
90 chain.
then([node =
token.node, node_manager]() {
91 auto& root = node_manager->get_root_node(
node_token, 0);
92 root.register_node(node);
95 accumulated_time = 0.F;
97 accumulated_time +=
token.seconds;
100 accumulated_time = 0.F;
static const auto node_token
static MayaFlux::Nodes::ProcessingToken token
ActionToken(std::shared_ptr< Nodes::Node > _node)
Constructs an ActionToken representing a node connection.
A token representing an action in a computational sequence.
Vruta::TaskScheduler & m_Scheduler
Reference to the scheduler that manages timing.
EventChain & then(std::function< void()> action, double delay_seconds=0.F)
Adds an event to the chain with a specified delay.
std::vector< TimedEvent > m_events
Collection of events in this chain.
void start()
Starts executing the event chain.
EventChain()
Constructs an EventChain using the global scheduler.
std::shared_ptr< Vruta::SoundRoutine > m_routine
The underlying computational routine that implements the chain.
A sequential chain of timed events with precise temporal control.
std::vector< ActionToken > tokens
Collection of actions in this sequence.
void execute()
Executes the sequence using the global managers.
Sequence & operator>>(const ActionToken &token)
Adds an action to the sequence.
A sequence of computational operations with a fluent, declarative API.
A C++20 coroutine-based audio processing task with sample-accurate timing.
void add_task(std::shared_ptr< Routine > routine, const std::string &name="", bool initialize=false)
Add a routine to the scheduler based on its processing token.
uint64_t seconds_to_samples(double seconds) const
Converts a time in seconds to a number of samples.
Token-based multimodal task scheduling system for unified coroutine processing.
@ AUDIO_RATE
Nodes that process at the audio sample rate.
std::shared_ptr< Nodes::NodeGraphManager > get_node_graph_manager()
Gets the node graph manager from the default engine.
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler from the default engine.
Main namespace for the Maya Flux audio engine.
Awaitable object for precise sample-accurate timing delays.