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

◆ activate_node()

void MayaFlux::Kriya::TemporalActivation::activate_node ( const std::shared_ptr< Nodes::Node > &  node,
double  duration_seconds,
Nodes::ProcessingToken  token = Nodes::ProcessingToken::AUDIO_RATE,
const std::vector< uint32_t > &  channels = {} 
)

Activates a node for a specified duration.

Parameters
nodeThe node to activate
tokenThe processing token associated with the node
duration_secondsThe duration to keep the node active (in seconds)
channelsOptional list of output channels to connect the node to (default is all channels)

This method activates the specified node by connecting it to the output channels or graphics sync, and starts a timer for the specified duration. When the timer expires, the node is automatically disconnected from the output channels, effectively deactivating it.

If another node, network, or buffer is already active, it will be cancelled before activating the new one.

Definition at line 103 of file Timers.cpp.

107{
108 cancel();
109
110 m_current_node = node;
111 m_node_token = token;
112 m_channels = channels;
114
115 for (auto channel : channels) {
116 m_node_graph_manager.add_to_root(node, token, channel);
117 }
118
119 m_timer.schedule(duration_seconds, [this]() {
121 });
122}
std::vector< uint32_t > m_channels
The output channels the current node is connected to.
Definition Timers.hpp:438
Nodes::ProcessingToken m_node_token
The processing token associated with the currently active node or buffer.
Definition Timers.hpp:411
void cleanup_current_operation()
Cleans up the current operation, disconnecting the entity and resetting state.
Definition Timers.cpp:164
Nodes::NodeGraphManager & m_node_graph_manager
Reference to the graph manager that manages processing nodes.
Definition Timers.hpp:359
void cancel()
Cancels any currently active node.
Definition Timers.cpp:209
std::shared_ptr< Nodes::Node > m_current_node
The currently active node being played.
Definition Timers.hpp:384
Timer m_timer
The timer used to schedule processing duration.
Definition Timers.hpp:375
void schedule(double delay_seconds, std::function< void()> callback)
Schedules a callback to execute after a delay.
Definition Timers.cpp:19
void add_to_root(const std::shared_ptr< Node > &node, ProcessingToken token, unsigned int channel=0)
Add node to specific processing token and channel.

References MayaFlux::Nodes::NodeGraphManager::add_to_root(), cancel(), cleanup_current_operation(), m_active_type, m_channels, m_current_node, m_node_graph_manager, m_node_token, m_timer, NODE, and MayaFlux::Kriya::Timer::schedule().

+ Here is the call graph for this function: