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

◆ process_sample()

double MayaFlux::Nodes::NodeGraphManager::process_sample ( ProcessingToken  token,
uint32_t  channel 
)

Process a single sample for a specific channel.

Parameters
tokenProcessing domain
channelChannel index within that domain
Returns
Processed sample value from the channel's root node

Processes a single sample for the specified channel and returns the processed value. If a custom per-sample processor is registered, it is used; otherwise, the default root node processing is performed. As node graph manager feeds into hardware audio output, the value returned is normalized

Definition at line 209 of file NodeGraphManager.cpp.

210{
211 auto& root = get_root_node(token, channel);
212
213 if (auto it = m_token_sample_processors.find(token); it != m_token_sample_processors.end()) {
214 return it->second(&root, channel);
215 }
216
217 double sample = root.process_sample();
218 normalize_sample(sample, root.get_node_size());
219 return sample;
220}
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.
std::unordered_map< ProcessingToken, TokenSampleProcessor > m_token_sample_processors
Per-sample processors for each processing token.
RootNode & get_root_node(ProcessingToken token, unsigned int channel)
Gets or creates the root node for a specific token and channel.

References get_root_node(), m_token_sample_processors, normalize_sample(), and token.

+ Here is the call graph for this function: