|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Central manager for the computational processing node graph. More...
#include <NodeGraphManager.hpp>
Collaboration diagram for MayaFlux::Nodes::NodeGraphManager:Public Member Functions | |
| NodeGraphManager () | |
| Creates a new NodeGraphManager. | |
| void | add_to_root (const std::shared_ptr< Node > &node, ProcessingToken token, unsigned int channel=0) |
| Add node to specific processing token and channel. | |
| void | remove_from_root (const std::shared_ptr< Node > &node, ProcessingToken token, unsigned int channel=0) |
| Remove node from a specific processing token and channel. | |
| void | add_to_root (const std::string &node_id, ProcessingToken token=ProcessingToken::AUDIO_RATE, unsigned int channel=0) |
| Adds a node to a channel's root node by its identifier. | |
| void | register_token_processor (ProcessingToken token, std::function< void(std::span< RootNode * >)> processor) |
| Register subsystem processor for a specific token. | |
| const std::unordered_map< unsigned int, std::shared_ptr< RootNode > > & | get_all_channel_root_nodes (ProcessingToken token=ProcessingToken::AUDIO_RATE) const |
| Gets all channel root nodes for the AUDIO_RATE domain. | |
| template<typename NodeType , typename... Args> | |
| std::shared_ptr< NodeType > | create_node (const std::string &id, Args &&... args) |
| Creates and registers a new node of the specified type. | |
| std::shared_ptr< Node > | get_node (const std::string &id) |
| Looks up a node by its string identifier. | |
| void | connect (const std::string &source_id, const std::string &target_id) |
| Connects two nodes by their string identifiers. | |
| bool | is_node_registered (const std::shared_ptr< Node > &node) |
| Checks if a node is registered with this manager. | |
| void | process_token (ProcessingToken token, unsigned int num_samples=1) |
| Process all nodes in a specific token domain Calls registered processor if available, otherwise calls process() on each root. | |
| void | register_token_channel_processor (ProcessingToken token, TokenChannelProcessor processor) |
| Register per-channel processor for a specific token. | |
| void | register_token_sample_processor (ProcessingToken token, TokenSampleProcessor processor) |
| Register per-sample processor for a specific token. | |
| std::vector< double > | process_channel (ProcessingToken token, unsigned int channel, unsigned int num_samples) |
| Process a specific channel within a token domain. | |
| double | process_sample (ProcessingToken token, uint32_t channel) |
| Process a single sample for a specific channel. | |
| std::unordered_map< unsigned int, std::vector< double > > | process_token_with_channel_data (ProcessingToken token, unsigned int num_samples) |
| Process all channels for a token and return channel-separated data. | |
| unsigned int | get_channel_count (ProcessingToken token) const |
| Get the number of active channels for a specific token. | |
| std::vector< RootNode * > | get_all_root_nodes (ProcessingToken token) |
| Get spans of root nodes for a token (for custom processing) | |
| RootNode & | get_root_node (ProcessingToken token, unsigned int channel) |
| Gets or creates the root node for a specific token and channel. | |
| void | process_all_tokens (unsigned int num_samples=1) |
| Process all active tokens sequentially. | |
| std::vector< ProcessingToken > | get_active_tokens () const |
| Gets all currently active processing tokens (domains) | |
| std::vector< unsigned int > | get_all_channels (ProcessingToken token) const |
| Gets all channel indices for a given processing token. | |
| size_t | get_node_count (ProcessingToken token) const |
| Gets the total number of nodes registered under a given token. | |
| void | print_summary () const |
| Prints a summary of all tokens, channels, and node counts. | |
| void | add_network (const std::shared_ptr< NodeNetwork > &network, ProcessingToken token) |
| Add a network to a processing token. | |
| void | remove_network (const std::shared_ptr< NodeNetwork > &network, ProcessingToken token) |
| Remove a network from a processing token. | |
| std::vector< std::shared_ptr< NodeNetwork > > | get_networks (ProcessingToken token, uint32_t channel=0) const |
| Get all networks for a specific token. | |
| std::vector< std::shared_ptr< NodeNetwork > > | get_all_networks (ProcessingToken token) const |
| Get all networks for a specific token across all channels. | |
| size_t | get_network_count (ProcessingToken token) const |
| Get count of networks for a token. | |
| void | clear_networks (ProcessingToken token) |
| Clear all networks from a token. | |
| void | register_network_global (const std::shared_ptr< NodeNetwork > &network) |
| Register network globally (like nodes) | |
| void | unregister_network_global (const std::shared_ptr< NodeNetwork > &network) |
| Unregister network globally. | |
| std::vector< std::vector< double > > | process_audio_networks (ProcessingToken token, uint32_t num_samples, uint32_t channel=0) |
| Process audio networks for a specific channel. | |
Private Member Functions | |
| void | ensure_root_exists (ProcessingToken token, unsigned int channel) |
| Ensures a root node exists for the given token and channel. | |
| void | ensure_token_exists (ProcessingToken token, uint32_t num_channels=1) |
| Ensures that a processing token entry exists. | |
| void | register_global (const std::shared_ptr< Node > &node) |
| Registers a node globally if not already registered. | |
| void | set_channel_mask (const std::shared_ptr< Node > &node, uint32_t channel_id) |
| Adds the specified channel mask to a node's global registration. | |
| void | unset_channel_mask (const std::shared_ptr< Node > &node, uint32_t channel_id) |
| Unsets the specified channel mask from a node's global registration. | |
| void | unregister_global (const std::shared_ptr< Node > &node) |
| Unregisters a node globally. | |
| void | normalize_sample (double &sample, uint32_t num_nodes) |
| Normalizes a sample to the range [-1, 1] based on the number of nodes. | |
| bool | is_network_registered (const std::shared_ptr< NodeNetwork > &network) |
| Check if network is registered globally. | |
| void | reset_audio_network_state (ProcessingToken token, uint32_t channel=0) |
| Resets the processing state of audio networks for a token and channel. | |
| bool | preprocess_networks (ProcessingToken token) |
| Preprocess networks for a specific token. | |
| void | postprocess_networks (ProcessingToken token, std::optional< uint32_t > channel) |
| Postprocess networks for a specific token and channel. | |
Private Attributes | |
| std::unordered_map< unsigned int, std::shared_ptr< RootNode > > | m_channel_root_nodes |
| Map of channel indices to their root nodes (AUDIO_RATE domain) | |
| std::unordered_map< std::string, std::shared_ptr< Node > > | m_Node_registry |
| Registry of all nodes by their string identifiers. | |
| std::unordered_map< ProcessingToken, std::unordered_map< unsigned int, std::shared_ptr< RootNode > > > | m_token_roots |
| Multi-modal map of processing tokens to their channel root nodes. | |
| std::unordered_map< ProcessingToken, std::function< void(std::span< RootNode * >)> > | m_token_processors |
| Registered custom processors for each processing token. | |
| std::unordered_map< ProcessingToken, TokenChannelProcessor > | m_token_channel_processors |
| Per-channel processors for each processing token. | |
| std::unordered_map< ProcessingToken, TokenSampleProcessor > | m_token_sample_processors |
| Per-sample processors for each processing token. | |
| std::unordered_map< std::string, std::shared_ptr< NodeNetwork > > | m_network_registry |
| Global network registry (like m_Node_registry) | |
| std::unordered_map< ProcessingToken, std::unordered_map< unsigned int, std::vector< std::shared_ptr< NodeNetwork > > > > | m_audio_networks |
| Audio-sink networks (channel-routed) Only populated for networks with OutputMode::AUDIO_SINK. | |
| std::unordered_map< ProcessingToken, std::vector< std::shared_ptr< NodeNetwork > > > | m_token_networks |
| Non-audio networks (token-level processing) For NONE, GRAPHICS_BIND, CUSTOM output modes. | |
| std::unordered_map< ProcessingToken, std::atomic< bool > > | m_token_network_processing |
| Processing flags for each token's networks. | |
Central manager for the computational processing node graph.
The NodeGraphManager is the primary interface for creating, connecting, and managing processing nodes in the MayaFlux engine. It serves as a registry for all nodes and maintains the root nodes for each processing channel and processing domain (token).
Features:
This class provides methods to:
The NodeGraphManager maintains separate root nodes for each processing channel. Channels are local to a specific processing domain. This allows for independent transformation chains per channel while sharing nodes between channels when needed.
Definition at line 39 of file NodeGraphManager.hpp.