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

◆ on_threshold()

void MayaFlux::Nodes::Generator::Phasor::on_threshold ( const NodeHook 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 174 of file Phasor.cpp.

175{
176 std::pair<NodeHook, double> entry = std::make_pair(callback, threshold);
177 for (auto& pair : m_threshold_callbacks) {
178 if (pair.first.target_type() == callback.target_type() && pair.second == threshold) {
179 return;
180 }
181 }
182 m_threshold_callbacks.push_back(entry);
183}
std::vector< std::pair< NodeHook, double > > m_threshold_callbacks
Collection of threshold-specific callback functions with their thresholds.
Definition Phasor.hpp:328

References m_threshold_callbacks.