Processes a single sample from all registered nodes.
This method processes each registered node and combines their outputs into a single sample. It is typically called in a loop to process multiple samples, but can also be used for single-sample processing.
110{
112 return 0.;
113
114 auto sample = 0.;
115
117 if (!node)
118 continue;
119
120 uint32_t state = node->m_state.load();
121 double node_output = 0.0;
122
124 auto generator = std::dynamic_pointer_cast<Nodes::Generator::Generator>(node);
125 if (generator && generator->should_mock_process()) {
126 generator->process_sample();
127 } else {
128 node_output = node->process_sample();
129 }
131 } else {
132 node_output = node->get_last_output();
133 }
134
135 if (node->needs_channel_routing()) {
136 node_output *= node->get_routing_state().amount[
m_channel];
137 }
138
139 sample += node_output;
140 }
141
143
144 return sample;
145}
std::vector< std::shared_ptr< Node > > m_Nodes
Collection of nodes registered with this root node.
uint32_t m_channel
The processing channel index for this root node.
bool preprocess()
Checks if the root node can process pending operations.
void postprocess()
Performs post-processing after all nodes have been processed.
@ PROCESSED
Node has been processed this cycle.
void atomic_add_flag(std::atomic< NodeState > &state, NodeState flag)
Atomically adds a flag to a node state.