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

◆ activate_network()

void MayaFlux::Kriya::TemporalActivation::activate_network ( const std::shared_ptr< Nodes::Network::NodeNetwork > &  network,
double  duration_seconds,
Nodes::ProcessingToken  token = Nodes::ProcessingToken::AUDIO_RATE,
const std::vector< uint32_t > &  channels = {} 
)

Activates a node network for a specified duration.

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

This method activates the specified node network by connecting it to the output channels or graphics sync, and starts a timer for the specified duration. When the timer expires, the network 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 124 of file Timers.cpp.

126{
127 cancel();
128
130 m_node_token = token;
132 m_channels = channels;
133
134 for (const auto& ch : channels) {
135 network->add_channel_usage(ch);
136 }
137
139
140 m_timer.schedule(duration_seconds, [this]() {
142 });
143}
Core::GlobalNetworkConfig network
Definition Config.cpp:37
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
std::shared_ptr< Nodes::Network::NodeNetwork > m_current_network
The currently active network being played.
Definition Timers.hpp:393
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
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_network(const std::shared_ptr< Network::NodeNetwork > &network, ProcessingToken token)
Add a network to a processing token.

References MayaFlux::Nodes::NodeGraphManager::add_network(), cancel(), cleanup_current_operation(), m_active_type, m_channels, m_current_network, m_node_graph_manager, m_node_token, m_timer, network, NETWORK, and MayaFlux::Kriya::Timer::schedule().

+ Here is the call graph for this function: