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

◆ initialize()

void MayaFlux::Nodes::BinaryOpNode::initialize ( )

Initializes the binary operation node.

This method performs any necessary setup for the binary operation node, such as ensuring both input nodes are properly initialized and registered. It should be called before the node is used for processing to ensure correct operation.

Definition at line 191 of file NodeStructure.cpp.

192{
193 if (!m_is_initialized) {
194 auto self = shared_from_this();
195 uint32_t lhs_mask = m_lhs ? m_lhs->get_channel_mask().load() : 0;
196 uint32_t rhs_mask = m_rhs ? m_rhs->get_channel_mask().load() : 0;
197 uint32_t combined_mask = lhs_mask | rhs_mask;
198
199 if (combined_mask != 0) {
200 for (auto& channel : get_active_channels(combined_mask, 0)) {
201 MayaFlux::register_audio_node(self, channel);
202 }
203 } else {
205 }
206 m_is_initialized = true;
207 }
208
210 switch (semantics) {
212 if (m_lhs) {
213 for (auto& channel : get_active_channels(m_lhs, 0)) {
215 }
216 }
217 if (m_rhs) {
218 for (auto& channel : get_active_channels(m_rhs, 0)) {
220 }
221 }
222 break;
224 default:
225 break;
226 }
227}
bool m_is_initialized
Flag indicating whether the binary operator has been properly initialized.
std::shared_ptr< Node > m_lhs
The left-hand side node.
std::shared_ptr< Node > m_rhs
The right-hand side node.
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.
@ KEEP
Preserve both nodes in the binary op, add new binary op node to root, i.e doubling the signal.
Definition Utils.hpp:57
@ REPLACE
Unregister both nodes and register with the new binary op node.
Definition Utils.hpp:56
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::NodeBinaryOpSemantics binary_op_semantics
Definition Config.hpp:31

References MayaFlux::Config::GraphConfig::binary_op_semantics, MayaFlux::Nodes::get_active_channels(), MayaFlux::Config::get_graph_config(), MayaFlux::Utils::KEEP, m_is_initialized, m_lhs, m_rhs, MayaFlux::register_audio_node(), MayaFlux::Utils::REPLACE, 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: