MayaFlux 1.0.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 660 of file NodeGraphManager.cpp.

665{
666 uint32_t current_channels = node->get_channel_mask();
667
668 uint32_t target_bitmask = 0;
669 for (auto ch : target_channels) {
670 target_bitmask |= (1 << ch);
671 }
672
673 uint32_t fade_blocks = (fade_cycles + m_registered_block_size - 1) / m_registered_block_size;
674 fade_blocks = std::max(1U, fade_blocks);
675
676 RoutingState state;
677 state.from_channels = current_channels;
678 state.to_channels = target_bitmask;
679 state.fade_cycles = fade_blocks;
680 state.phase = RoutingState::ACTIVE;
681
682 for (uint32_t ch = 0; ch < 32; ch++) {
683 state.amount[ch] = (current_channels & (1 << ch)) ? 1.0 : 0.0;
684 }
685
686 node->get_routing_state() = state;
687
688 for (auto ch : target_channels) {
689 if (!(current_channels & (1 << ch))) {
690 add_to_root(node, token, ch);
691 }
692 }
693}
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:86

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: