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

◆ on_threshold()

HookId MayaFlux::Nodes::Generator::Phasor::on_threshold ( const TypedHook< GeneratorContext > &  callback,
double  threshold,
bool  rising = true 
)

Registers a callback for every time the phasor crosses a threshold.

Parameters
callbackFunction to call when the threshold is crossed
thresholdValue at which to trigger the callback
risingWhether to trigger on rising (true) or falling (false) edges

This method allows external components to monitor or react to every time the phasor crosses a specific threshold value. The callback receives a GeneratorContext containing the generated value and generator parameters like frequency, amplitude, and phase.

Definition at line 173 of file Phasor.cpp.

174{
175 return m_threshold_callbacks.add_unique(adapt_hook(callback), callback.target_type(), 0, { threshold, 0.0 });
176}
PickCallback callback
Definition Picker.cpp:22
HookList m_threshold_callbacks
Collection of threshold-specific callback functions with their thresholds.
Definition Phasor.hpp:303
HookId add_unique(NodeHook hook, const std::type_info &key, uint8_t tag=0, std::array< double, 2 > params={})
Appends unless an entry with the same key and params exists, in which case that entry's id is returne...
NodeHook adapt_hook(const TypedHook< ContextT > &hook)
Wraps a context-typed hook into a NodeHook.

References MayaFlux::Nodes::adapt_hook(), MayaFlux::Nodes::HookList::add_unique(), callback, and m_threshold_callbacks.

+ Here is the call graph for this function: