MayaFlux 0.3.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 688 of file NodeGraphManager.cpp.

693{
694 uint32_t current_channels = node->get_channel_mask();
695
696 uint32_t target_bitmask = 0;
697 for (auto ch : target_channels) {
698 target_bitmask |= (1 << ch);
699 }
700
701 uint32_t fade_blocks = (fade_cycles + m_registered_block_size - 1) / m_registered_block_size;
702 fade_blocks = std::max(1U, fade_blocks);
703
704 RoutingState state;
705 state.from_channels = current_channels;
706 state.to_channels = target_bitmask;
707 state.fade_cycles = fade_blocks;
708 state.phase = RoutingState::ACTIVE;
709
710 for (uint32_t ch = 0; ch < 32; ch++) {
711 state.amount[ch] = (current_channels & (1 << ch)) ? 1.0 : 0.0;
712 }
713
714 node->get_routing_state() = state;
715
716 for (auto ch : target_channels) {
717 if (!(current_channels & (1 << ch))) {
718 add_to_root(node, token, ch);
719 }
720 }
721}
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: