MayaFlux 0.2.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 176 of file Phasor.cpp.

177{
178 std::pair<NodeHook, double> entry = std::make_pair(callback, threshold);
179 for (auto& pair : m_threshold_callbacks) {
180 if (pair.first.target_type() == callback.target_type() && pair.second == threshold) {
181 return;
182 }
183 }
184 m_threshold_callbacks.push_back(entry);
185}
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.