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

◆ notify_tick()

void MayaFlux::Nodes::Generator::Impulse::notify_tick ( double  value)
overrideprotectedvirtual

Notifies all registered callbacks about a new sample.

Parameters
valueThe newly generated sample

This method is called internally whenever a new sample is generated, creating the appropriate context and invoking all registered callbacks that should receive notification about this sample.

Implements MayaFlux::Nodes::Node.

Definition at line 184 of file Impulse.cpp.

185{
186 update_context(value);
187 auto& ctx = get_last_context();
188
189 for (auto& callback : m_callbacks) {
190 callback(ctx);
191 }
192 for (auto& [callback, condition] : m_conditional_callbacks) {
193 if (condition(ctx)) {
194 callback(ctx);
195 }
196 }
197 if (m_impulse_occurred) {
198 for (auto& callback : m_impulse_callbacks) {
199 callback(ctx);
200 }
201 }
202}
NodeContext & get_last_context() override
Gets the last created context object.
Definition Generator.cpp:49
virtual void update_context(double value) override
Updates the context object for callbacks.
Definition Generator.cpp:19
std::vector< NodeHook > m_impulse_callbacks
Collection of impulse-specific callback functions.
Definition Impulse.hpp:276
std::vector< NodeHook > m_callbacks
Collection of standard callback functions.
Definition Node.hpp:403
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
Collection of conditional callback functions with their predicates.
Definition Node.hpp:413

References MayaFlux::Nodes::Generator::Generator::get_last_context(), MayaFlux::Nodes::Node::m_callbacks, MayaFlux::Nodes::Node::m_conditional_callbacks, m_impulse_callbacks, m_impulse_occurred, and MayaFlux::Nodes::Generator::Generator::update_context().

Referenced by process_sample().

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