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

◆ route_node_to_channels()

void MayaFlux::Nodes::NodeGraphManager::route_node_to_channels ( const std::shared_ptr< Node > &  node,
const std::vector< uint32_t > &  target_channels,
uint32_t  fade_cycles,
ProcessingToken  token 
)

Routes a node's output to specific channels within a token domain.

Parameters
nodeNode to route
target_channelsVector of channel indices to route the node's output to
fade_cyclesNumber of cycles to fade in the routing (optional)
tokenProcessing domain to route within

This method adds the specified node to the root nodes of the target channels within the given processing domain. If fade_cycles is greater than 0, the routing will be smoothly faded in over that many processing cycles.

Definition at line 646 of file NodeGraphManager.cpp.

651{
652 uint32_t current_channels = node->get_channel_mask();
653
654 uint32_t target_bitmask = 0;
655 for (auto ch : target_channels) {
656 target_bitmask |= (1 << ch);
657 }
658
659 uint32_t fade_blocks = (fade_cycles + m_registered_block_size - 1) / m_registered_block_size;
660 fade_blocks = std::max(1U, fade_blocks);
661
662 RoutingState state;
663 state.from_channels = current_channels;
664 state.to_channels = target_bitmask;
665 state.fade_cycles = fade_blocks;
666 state.phase = RoutingState::ACTIVE;
667
668 for (uint32_t ch = 0; ch < 32; ch++) {
669 state.amount[ch] = (current_channels & (1 << ch)) ? 1.0 : 0.0;
670 }
671
672 node->get_routing_state() = state;
673
674 for (auto ch : target_channels) {
675 if (!(current_channels & (1 << ch))) {
676 add_to_root(node, token, ch);
677 }
678 }
679}
uint32_t m_registered_block_size
Block size for audio processing, used for normalizationbuffer.
void add_to_root(const std::shared_ptr< Node > &node, ProcessingToken token, unsigned int channel=0)
Add node to specific processing token and channel.
@ ACTIVE
Currently in the fade-out phase of a routing transition.
Definition NodeSpec.hpp:81

References MayaFlux::Nodes::RoutingState::ACTIVE, add_to_root(), MayaFlux::Nodes::RoutingState::amount, MayaFlux::Nodes::RoutingState::fade_cycles, MayaFlux::Nodes::RoutingState::from_channels, m_registered_block_size, and MayaFlux::Nodes::RoutingState::to_channels.

+ Here is the call graph for this function: