MayaFlux 0.2.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 196 of file NodeGraphManager.cpp.

198{
199 if (channel == 0) {
201 }
202
203 auto& root = get_root_node(token, channel);
204
205 if (auto it = m_token_channel_processors.find(token); it != m_token_channel_processors.end()) {
206 return it->second(&root, num_samples);
207 }
208
209 std::vector<double> samples = root.process_batch(num_samples);
210
211 uint32_t normalize_coef = root.get_node_size();
212 for (double& sample : samples) {
213 normalize_sample(sample, normalize_coef);
214 }
215 return samples;
216}
static MayaFlux::Nodes::ProcessingToken token
Definition Timers.cpp:8
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(), reset_audio_network_state(), and token.

Referenced by process_token_with_channel_data().

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