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

◆ operator|() [4/7]

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

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

This operator overload implements the syntax:

buffer >> Time(2.0, 1) | 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 buffer in the given domain for the specified duration and channel(s).

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

Definition at line 45 of file Temporal.cpp.

46{
47 auto buffer = wrapper.entity();
48 const auto& spec = wrapper.spec();
49 auto buffer_token = get_buffer_token(domain);
50
51 auto activation = std::make_shared<Kriya::TemporalActivation>(*get_scheduler(), *get_node_graph_manager(), *get_buffer_manager());
52
53 if (spec.channels.has_value() && !spec.channels.value().empty()) {
54 activation->activate_buffer(buffer, spec.seconds, buffer_token, spec.channels.value()[0]);
55 } else {
56 activation->activate_buffer(buffer, spec.seconds, buffer_token);
57 }
58
59 static std::vector<std::shared_ptr<Kriya::TemporalActivation>> active_timers;
60 active_timers.push_back(activation);
61
62 if (active_timers.size() > 100) {
63 std::erase_if(active_timers, [](const std::shared_ptr<Kriya::TemporalActivation>& t) {
64 return !t->is_active();
65 });
66 }
67
68 return buffer;
69}
const TimeSpec & spec() const
Definition Temporal.hpp:100
std::shared_ptr< T > entity() const
Definition Temporal.hpp:99
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
MAYAFLUX_API Buffers::ProcessingToken get_buffer_token(Domain domain)
Extracts buffer processing token from domain.
Definition Domain.hpp:184

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

+ Here is the call graph for this function: