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

◆ process_token()

void MayaFlux::Nodes::NodeGraphManager::process_token ( ProcessingToken  token,
unsigned int  num_samples = 1 
)

Process all nodes in a specific token domain Calls registered processor if available, otherwise calls process() on each root.

Parameters
tokenProcessing domain to process
num_samplesNumber of samples/frames to process

Processes all root nodes for the specified processing domain (token). If a custom processor is registered for the token, it is called with all root nodes. Otherwise, process() is called on each root node individually.

Definition at line 66 of file NodeGraphManager.cpp.

67{
68 auto roots = get_all_root_nodes(token);
69
70 if (auto it = m_token_processors.find(token); it != m_token_processors.end()) {
71 it->second(std::span<RootNode*>(roots.data(), roots.size()));
72 return;
73 }
74
76 return;
77 }
78
79 auto it = m_token_networks.find(token);
80 if (it != m_token_networks.end()) {
81 for (auto& network : it->second) {
82 if (!network || !network->is_enabled()) {
83 continue;
84 }
85
86 if (!network->is_processed_this_cycle()) {
87 network->mark_processing(true);
88 network->process_batch(num_samples);
89 network->mark_processing(false);
90 network->mark_processed(true);
91 }
92 }
93 }
94
95 postprocess_networks(token, std::nullopt);
96
98 for (auto* root : roots) {
99 root->process_batch(num_samples);
100 }
101 } else if (token == ProcessingToken::VISUAL_RATE) {
102 for (auto* root : roots) {
103 root->process_batch_frame(num_samples);
104 }
105 }
106}
static MayaFlux::Nodes::ProcessingToken token
Definition Timers.cpp:8
std::unordered_map< ProcessingToken, std::function< void(std::span< RootNode * >)> > m_token_processors
Registered custom processors for each processing token.
bool preprocess_networks(ProcessingToken token)
Preprocess networks for a specific token.
void postprocess_networks(ProcessingToken token, std::optional< uint32_t > channel)
Postprocess networks for a specific token and channel.
std::vector< RootNode * > get_all_root_nodes(ProcessingToken token)
Get spans of root nodes for a token (for custom processing)
std::unordered_map< ProcessingToken, std::vector< std::shared_ptr< NodeNetwork > > > m_token_networks
Non-audio networks (token-level processing) For NONE, GRAPHICS_BIND, CUSTOM output modes.
@ AUDIO_RATE
Nodes that process at the audio sample rate.
@ VISUAL_RATE
Nodes that process at the visual frame rate.

References MayaFlux::Nodes::AUDIO_RATE, get_all_root_nodes(), m_token_networks, m_token_processors, postprocess_networks(), preprocess_networks(), token, and MayaFlux::Nodes::VISUAL_RATE.

Referenced by process_all_tokens().

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