MayaFlux 0.3.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 87 of file Timers.cpp.

91{
92 cancel();
93
94 m_current_node = node;
95 m_node_token = token;
96 m_channels = channels;
98
99 for (auto channel : channels) {
100 m_node_graph_manager.add_to_root(node, token, channel);
101 }
102
103 m_timer.schedule(duration_seconds, [this]() {
105 });
106}
std::vector< uint32_t > m_channels
The output channels the current node is connected to.
Definition Timers.hpp:415
Nodes::ProcessingToken m_node_token
The processing token associated with the currently active node or buffer.
Definition Timers.hpp:397
void cleanup_current_operation()
Cleans up the current operation, disconnecting the entity and resetting state.
Definition Timers.cpp:148
Nodes::NodeGraphManager & m_node_graph_manager
Reference to the graph manager that manages processing nodes.
Definition Timers.hpp:345
void cancel()
Cancels any currently active node.
Definition Timers.cpp:193
std::shared_ptr< Nodes::Node > m_current_node
The currently active node being played.
Definition Timers.hpp:370
Timer m_timer
The timer used to schedule processing duration.
Definition Timers.hpp:361
void schedule(double delay_seconds, std::function< void()> callback)
Schedules a callback to execute after a delay.
Definition Timers.cpp:18
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: