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

110{
111 cancel();
112
113 m_current_network = network;
114 m_node_token = token;
116 m_channels = channels;
117
118 for (const auto& ch : channels) {
119 network->add_channel_usage(ch);
120 }
121
122 m_node_graph_manager.add_network(network, token);
123
124 m_timer.schedule(duration_seconds, [this]() {
126 });
127}
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
std::shared_ptr< Nodes::Network::NodeNetwork > m_current_network
The currently active network being played.
Definition Timers.hpp:379
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
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_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, and MayaFlux::Kriya::Timer::schedule().

+ Here is the call graph for this function: