78 void add_to_root(
const std::shared_ptr<Node>& node,
ProcessingToken token,
unsigned int channel = 0);
89 void remove_from_root(
const std::shared_ptr<Node>& node,
ProcessingToken token,
unsigned int channel = 0);
103 auto node = get_node(node_id);
105 add_to_root(node, token, channel);
120 std::function<
void(std::span<RootNode*>)> processor);
131 const std::unordered_map<unsigned int, std::shared_ptr<RootNode>>& get_all_channel_root_nodes(
ProcessingToken token = ProcessingToken::AUDIO_RATE)
const;
151 template <
typename NodeType,
typename... Args>
152 inline std::shared_ptr<NodeType>
create_node(
const std::string&
id, Args&&... args)
154 auto node = std::make_shared<NodeType>(std::forward<Args>(args)...);
155 m_Node_registry[id] = node;
168 std::shared_ptr<Node> get_node(
const std::string&
id);
185 void connect(
const std::string& source_id,
const std::string& target_id);
195 bool is_node_registered(
const std::shared_ptr<Node>& node);
207 void process_token(
ProcessingToken token,
unsigned int num_samples = 1);
243 std::vector<double> process_channel(
ProcessingToken token,
unsigned int channel,
unsigned int num_samples);
268 std::unordered_map<unsigned int, std::vector<double>> process_token_with_channel_data(
306 void process_all_tokens(
unsigned int num_samples = 1);
315 std::vector<ProcessingToken> get_active_tokens()
const;
322 std::vector<unsigned int> get_all_channels(
ProcessingToken token)
const;
338 void print_summary()
const;
352 void add_network(
const std::shared_ptr<Network::NodeNetwork>& network,
ProcessingToken token);
360 void remove_network(
const std::shared_ptr<Network::NodeNetwork>& network,
ProcessingToken token);
367 [[nodiscard]] std::vector<std::shared_ptr<Network::NodeNetwork>> get_networks(
ProcessingToken token, uint32_t channel = 0)
const;
374 [[nodiscard]] std::vector<std::shared_ptr<Network::NodeNetwork>> get_all_networks(
ProcessingToken token)
const;
389 void register_network_global(
const std::shared_ptr<Network::NodeNetwork>& network);
394 void unregister_network_global(
const std::shared_ptr<Network::NodeNetwork>& network);
406 std::vector<std::vector<double>> process_audio_networks(
ProcessingToken token, uint32_t num_samples, uint32_t channel = 0);
414 void terminate_active_processing();
427 void route_node_to_channels(
428 const std::shared_ptr<Node>& node,
429 const std::vector<uint32_t>& target_channels,
430 uint32_t fade_cycles,
444 void route_network_to_channels(
445 const std::shared_ptr<Network::NodeNetwork>& network,
446 const std::vector<uint32_t>& target_channels,
447 uint32_t fade_cycles,
508 std::unordered_map<unsigned int, std::shared_ptr<RootNode>>>
519 std::function<void(std::span<RootNode*>)>>
552 std::vector<std::shared_ptr<Network::NodeNetwork>>>
559 std::unordered_map<ProcessingToken, std::vector<std::shared_ptr<Network::NodeNetwork>>>
569 std::atomic<bool> m_terminate_requested {
false };
571 uint32_t m_registered_sample_rate { 48000 };
573 uint32_t m_registered_block_size { 512 };
594 void ensure_token_exists(
ProcessingToken token, uint32_t num_channels = 1);
602 void register_global(
const std::shared_ptr<Node>& node);
609 void set_channel_mask(
const std::shared_ptr<Node>& node, uint32_t channel_id);
618 void unset_channel_mask(
const std::shared_ptr<Node>& node, uint32_t channel_id);
626 void unregister_global(
const std::shared_ptr<Node>& node);
635 void normalize_sample(
double& sample, uint32_t num_nodes);
640 bool is_network_registered(
const std::shared_ptr<Network::NodeNetwork>& network);
647 void reset_audio_network_state(
ProcessingToken token, uint32_t channel = 0);
661 void postprocess_networks(
ProcessingToken token, std::optional<uint32_t> channel);