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

◆ operator|() [6/7]

MAYAFLUX_API std::shared_ptr< Nodes::Node > MayaFlux::operator| ( const TemporalWrapper< Nodes::Node > &  wrapper,
Domain  domain 
)

Activates a node in a specific domain for the duration specified by the TemporalWrapper.

This operator overload implements the syntax:

process_node >> Time(2.0) | domain;
TimeSpec Time(double seconds, uint32_t channel)
Creates a TimeSpec with the specified duration and a single channel.
Definition Temporal.cpp:9

It activates the wrapped node in the given domain for the specified duration and channels.

Parameters
wrapperThe TemporalWrapper containing the node and timing information.
domainThe domain in which to activate the node.
Returns
A shared pointer to the activated node.

Definition at line 19 of file Temporal.cpp.

20{
21 auto node = wrapper.entity();
22 const auto& spec = wrapper.spec();
23 auto node_token = get_node_token(domain);
24
25 auto activation = std::make_shared<Kriya::TemporalActivation>(*get_scheduler(), *get_node_graph_manager(), *get_buffer_manager());
26
27 if (spec.channels.has_value()) {
28 activation->activate_node(node, spec.seconds, node_token, spec.channels.value());
29 } else {
30 activation->activate_node(node, spec.seconds, node_token);
31 }
32
33 static std::vector<std::shared_ptr<Kriya::TemporalActivation>> active_timers;
34 active_timers.push_back(activation);
35
36 if (active_timers.size() > 100) {
37 std::erase_if(active_timers, [](const std::shared_ptr<Kriya::TemporalActivation>& t) {
38 return !t->is_active();
39 });
40 }
41
42 return node;
43}
static const auto node_token
Definition Chain.cpp:9
const TimeSpec & spec() const
Definition Temporal.hpp:100
std::shared_ptr< T > entity() const
Definition Temporal.hpp:99
MAYAFLUX_API Nodes::ProcessingToken get_node_token(Domain domain)
Extracts node processing token from domain.
Definition Domain.hpp:174
std::shared_ptr< Nodes::NodeGraphManager > get_node_graph_manager()
Gets the node graph manager from the default engine.
Definition Graph.cpp:35
std::shared_ptr< Buffers::BufferManager > get_buffer_manager()
Gets the buffer manager from the default engine.
Definition Graph.cpp:133
std::shared_ptr< Vruta::TaskScheduler > get_scheduler()
Gets the task scheduler from the default engine.
Definition Chronie.cpp:20

References MayaFlux::TemporalWrapper< T >::entity(), get_buffer_manager(), get_node_graph_manager(), get_node_token(), get_scheduler(), node_token, and MayaFlux::TemporalWrapper< T >::spec().

+ Here is the call graph for this function: