Cleans up completed routing transitions for a given token.
This method should be called after routing states have been updated to remove any nodes or networks that have completed their fade-out transitions and are no longer contributing to the output of their previous channels.
777{
778 std::vector<std::pair<std::shared_ptr<Node>, uint32_t>> nodes_to_remove;
779
781 if (!node->needs_channel_routing())
782 continue;
783
784 auto& state = node->get_routing_state();
785
787 for (uint32_t ch = 0; ch < 32; ch++) {
788 if ((state.from_channels & (1 << ch)) && !(state.to_channels & (1 << ch))) {
789 nodes_to_remove.emplace_back(node, ch);
790 }
791 }
792 state = RoutingState {};
793 }
794 }
795
796 for (
auto& [node,
channel] : nodes_to_remove) {
798 }
799
800 std::vector<std::pair<std::shared_ptr<Network::NodeNetwork>, uint32_t>> networks_to_cleanup;
801
803 if (!network || !network->needs_channel_routing())
804 continue;
805
806 auto& state = network->get_routing_state();
807
809 network->set_channel_mask(state.to_channels);
810
811 for (uint32_t ch = 0; ch < 32; ch++) {
812 if ((state.from_channels & (1 << ch)) && !(state.to_channels & (1 << ch))) {
813 networks_to_cleanup.emplace_back(network, ch);
814 }
815 }
816 state = RoutingState {};
817 }
818 }
819
820 for (
auto& [network,
channel] : networks_to_cleanup) {
821 network->remove_channel_usage(
channel);
822
823 if (network->get_channel_mask() == 0) {
825 std::erase_if(networks, [&](const auto& n) { return n == network; });
827 }
828 }
829}
std::unordered_map< std::string, std::shared_ptr< Node > > m_Node_registry
Registry of all nodes by their string identifiers.
std::vector< std::shared_ptr< Network::NodeNetwork > > get_all_networks(ProcessingToken token) const
Get all networks for a specific token across all channels.
void remove_from_root(const std::shared_ptr< Node > &node, ProcessingToken token, unsigned int channel=0)
Remove node from a specific processing token and channel.
std::unordered_map< ProcessingToken, std::vector< std::shared_ptr< Network::NodeNetwork > > > m_audio_networks
Audio-sink networks Only populated for networks with OutputMode::AUDIO_SINK.
void unregister_network_global(const std::shared_ptr< Network::NodeNetwork > &network)
Unregister network globally.
@ COMPLETED
Routing transition has completed.