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

◆ initialize()

void MayaFlux::Nodes::ChainNode::initialize ( )

Initializes the chain node.

This method performs necessary setup for the chain node, ensuring both the source and target nodes are properly initialized and registered. It should be called before the chain is used for processing to ensure correct signal flow through the connected nodes.

Initialization is particularly important for chains to ensure that the signal path is properly established before processing begins.

Definition at line 22 of file NodeStructure.cpp.

23{
24 if (!m_is_initialized) {
25 auto self = shared_from_this();
26
27 if (m_Target) {
28 for (auto& channel : get_active_channels(m_Target, 0)) {
29 MayaFlux::register_audio_node(self, channel);
30 }
31 } else {
33 }
34 m_is_initialized = true;
35 }
36
38 switch (semantics) {
40 if (m_Target) {
41 for (auto& channel : get_active_channels(m_Target, 0)) {
43 }
44 }
45 break;
47 if (m_Source) {
48 for (auto& channel : get_active_channels(m_Source, 0)) {
50 }
51 }
52 if (m_Target) {
53 for (auto& channel : get_active_channels(m_Target, 0)) {
55 }
56 }
57 break;
59 default:
60 break;
61 }
62}
std::shared_ptr< Node > m_Source
The upstream node that processes input first.
std::shared_ptr< Node > m_Target
The downstream node that processes the source's output.
bool m_is_initialized
Flag indicating whether the chain has been properly initialized.
GraphConfig & get_graph_config()
Definition Config.cpp:42
std::vector< uint32_t > get_active_channels(const std::shared_ptr< Nodes::Node > &node, uint32_t fallback_channel)
Extracts active channel list from a node's channel mask.
@ PRESERVE_BOTH
Preserve both nodes in the chain, add new chain node to root, i.e doubling the target signal.
Definition Utils.hpp:47
@ REPLACE_TARGET
Unregister the target and register with the new chain node.
Definition Utils.hpp:46
@ ONLY_CHAIN
Only keep the new chain node, unregistering the source and target.
Definition Utils.hpp:48
void register_audio_node(const std::shared_ptr< Nodes::Node > &node, uint32_t channel)
Adds a node to the root node of a specific channel.
Definition Graph.cpp:36
void unregister_audio_node(const std::shared_ptr< Nodes::Node > &node, uint32_t channel)
Removes a node from the root node of a specific channel.
Definition Graph.cpp:58
Utils::NodeChainSemantics chain_semantics
Definition Config.hpp:30

References MayaFlux::Config::GraphConfig::chain_semantics, MayaFlux::Nodes::get_active_channels(), MayaFlux::Config::get_graph_config(), m_is_initialized, m_Source, m_Target, MayaFlux::Utils::ONLY_CHAIN, MayaFlux::Utils::PRESERVE_BOTH, MayaFlux::register_audio_node(), MayaFlux::Utils::REPLACE_TARGET, and MayaFlux::unregister_audio_node().

Referenced by process_sample().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: