MayaFlux 0.1.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 187 of file NodeGraphManager.cpp.

189{
190 if (channel == 0) {
192 }
193
194 auto& root = get_root_node(token, channel);
195
196 if (auto it = m_token_channel_processors.find(token); it != m_token_channel_processors.end()) {
197 return it->second(&root, num_samples);
198 }
199
200 std::vector<double> samples = root.process_batch(num_samples);
201
202 uint32_t normalize_coef = root.get_node_size();
203 for (double& sample : samples) {
204 normalize_sample(sample, normalize_coef);
205 }
206 return samples;
207}
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: