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

◆ notify_tick()

void MayaFlux::Nodes::Generator::Phasor::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.

Reimplemented from MayaFlux::Nodes::Generator::Generator.

Definition at line 188 of file Phasor.cpp.

189{
191
192 auto& ctx = get_last_context();
193
194 m_callbacks.fire(ctx);
195
196 if (m_phase_wrapped) {
198 }
199
201
202 for (const auto& entry : m_threshold_callbacks.snapshot()) {
203 const double threshold = entry.params[0];
205 entry.hook(ctx);
206 m_threshold_crossed = true;
207 } else if (value < threshold) {
208 m_threshold_crossed = false;
209 }
210 }
211}
glm::vec3 value
float threshold
NodeContext & get_last_context() override
Gets the last created context object.
Definition Generator.cpp:37
virtual void update_context(double value) override
Updates the context object for callbacks.
Definition Generator.cpp:7
bool m_threshold_crossed
Flag indicating whether the threshold has been crossed in the current sample.
Definition Phasor.hpp:313
bool m_phase_wrapped
Flag indicating whether the phase has wrapped in the current sample.
Definition Phasor.hpp:308
HookList m_threshold_callbacks
Collection of threshold-specific callback functions with their thresholds.
Definition Phasor.hpp:303
HookList m_phase_wrap_callbacks
Collection of phase wrap-specific callback functions.
Definition Phasor.hpp:298
void fire(NodeContext &ctx) const
Calls every entry whose condition, if any, holds.
Definition NodeUtils.cpp:68
HookList m_conditional_callbacks
Hooks fired on a tick only while their condition holds.
Definition Node.hpp:485
HookList m_callbacks
Hooks fired on every tick.
Definition Node.hpp:478

References MayaFlux::Nodes::HookList::fire(), MayaFlux::Nodes::Generator::Generator::get_last_context(), MayaFlux::Nodes::Node::m_callbacks, MayaFlux::Nodes::Node::m_conditional_callbacks, m_phase_wrap_callbacks, m_phase_wrapped, m_threshold_callbacks, m_threshold_crossed, MayaFlux::Nodes::HookList::snapshot(), threshold, MayaFlux::Nodes::Generator::Generator::update_context(), and value.

Referenced by process_sample().

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