MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kriya::TemporalActivation Class Reference

Specialized timer for controlling computational nodes, buffers, and networks. More...

#include <Timers.hpp>

+ Collaboration diagram for MayaFlux::Kriya::TemporalActivation:

Public Member Functions

 TemporalActivation (Vruta::TaskScheduler &scheduler, Nodes::NodeGraphManager &graph_manager, Buffers::BufferManager &buffer_manager)
 Constructs a TemporalActivation with the specified scheduler and manager.
 
 ~TemporalActivation ()=default
 
void 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.
 
void 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.
 
void activate_buffer (const std::shared_ptr< Buffers::Buffer > &buffer, double duration_seconds, Buffers::ProcessingToken token=Buffers::ProcessingToken::AUDIO_BACKEND, uint32_t channel=0)
 Activates a buffer for a specified duration.
 
void cancel ()
 Cancels any currently active node.
 
bool is_active () const
 Checks if a node is currently active.
 

Private Types

enum class  ActiveType : uint8_t { NONE , NODE , BUFFER , NETWORK }
 

Private Member Functions

void cleanup_current_operation ()
 Cleans up the current operation, disconnecting the entity and resetting state.
 

Private Attributes

Vruta::TaskSchedulerm_scheduler
 Reference to the scheduler that manages this timer.
 
Nodes::NodeGraphManagerm_node_graph_manager
 Reference to the graph manager that manages processing nodes.
 
Buffers::BufferManagerm_buffer_manager
 Reference to the buffer manager that manages processing buffers.
 
Timer m_timer
 The timer used to schedule processing duration.
 
std::shared_ptr< Nodes::Nodem_current_node
 The currently active node being played.
 
std::shared_ptr< Nodes::Network::NodeNetworkm_current_network
 The currently active network being played.
 
std::shared_ptr< Buffers::Bufferm_current_buffer
 The currently active buffer being played.
 
Nodes::ProcessingToken m_node_token
 The processing token associated with the currently active node or buffer.
 
Buffers::ProcessingToken m_buffer_token
 The processing token associated with the currently active buffer.
 
std::vector< uint32_t > m_channels
 The output channels the current node is connected to.
 
ActiveType m_active_type = ActiveType::NONE
 

Detailed Description

Specialized timer for controlling computational nodes, buffers, and networks.

The TemporalActivation class provides a high-level interface for activating nodes, buffers, or entire networks for a specified duration. It manages the lifecycle of the activated entity, ensuring that it is properly connected to the processing graph when activated and cleanly disconnected when the timer expires.

Usage example:

// Create a temporal activation
TemporalActivation activation(*scheduler, node_graph_manager, buffer_manager);
// Activate a node for 5 seconds on channels 0 and 1
activation.activate_node(my_node, my_token, 5.0, {0, 1});
Specialized timer for controlling computational nodes, buffers, and networks.
Definition Timers.hpp:232

Definition at line 232 of file Timers.hpp.


The documentation for this class was generated from the following files: