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

◆ notify_tick()

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

Notifies all registered callbacks with the current context.

Parameters
valueThe current sample value

This method is called by the node implementation when a new output value is produced. It creates a context object using create_context(), then calls all registered callbacks with that context.

For unconditional callbacks (registered with on_tick()), the callback is always called. For conditional callbacks (registered with on_tick_if()), the callback is called only if its condition returns true.

Node implementations should call this method at appropriate points in their processing flow to trigger callbacks.

Implements MayaFlux::Nodes::Node.

Reimplemented in MayaFlux::Nodes::Generator::Impulse, MayaFlux::Nodes::Generator::Logic, and MayaFlux::Nodes::Generator::Phasor.

Definition at line 70 of file Generator.cpp.

71{
72 update_context(value);
73 auto& ctx = get_last_context();
74 for (auto& cb : m_callbacks) {
75 cb(ctx);
76 }
77 for (auto& [cb, cond] : m_conditional_callbacks) {
78 if (cond(ctx)) {
79 cb(ctx);
80 }
81 }
82}
NodeContext & get_last_context() override
Gets the last created context object.
Definition Generator.cpp:51
virtual void update_context(double value) override
Updates the context object for callbacks.
Definition Generator.cpp:21
std::vector< NodeHook > m_callbacks
Collection of standard callback functions.
Definition Node.hpp:434
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
Collection of conditional callback functions with their predicates.
Definition Node.hpp:444

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

Referenced by MayaFlux::Nodes::Generator::Polynomial::process_sample(), MayaFlux::Nodes::Generator::Random::process_sample(), and MayaFlux::Nodes::Generator::Sine::process_sample().

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