MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ process_channel()

std::vector< double > MayaFlux::Nodes::NodeGraphManager::process_channel ( ProcessingToken  token,
unsigned int  channel,
unsigned int  num_samples 
)

Process a specific channel within a token domain.

Parameters
tokenProcessing domain
channelChannel index within that domain
num_samplesNumber of samples/frames to process
Returns
Processed data from the channel's root node

Processes a single channel's root node and returns the processed data. If a custom per-channel processor is registered, it is used; otherwise, the default root node processing is performed.

Definition at line 220 of file NodeGraphManager.cpp.

222{
223 if (channel == 0) {
225 }
226
227 auto& root = get_root_node(token, channel);
228
229 if (auto it = m_token_channel_processors.find(token); it != m_token_channel_processors.end()) {
230 return it->second(&root, num_samples);
231 }
232
233 std::vector<double> samples = root.process_batch(num_samples);
234
235 uint32_t normalize_coef = root.get_node_size();
236 for (double& sample : samples) {
237 normalize_sample(sample, normalize_coef);
238 }
239 return samples;
240}
void normalize_sample(double &sample, uint32_t num_nodes)
Normalizes a sample to the range [-1, 1] based on the number of nodes.
void reset_audio_network_state(ProcessingToken token, uint32_t channel=0)
Resets the processing state of audio networks for a token and channel.
RootNode & get_root_node(ProcessingToken token, unsigned int channel)
Gets or creates the root node for a specific token and channel.
std::unordered_map< ProcessingToken, TokenChannelProcessor > m_token_channel_processors
Per-channel processors for each processing token.

References get_root_node(), m_token_channel_processors, normalize_sample(), and reset_audio_network_state().

Referenced by process_token_with_channel_data().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: