diff --git a/include/dsp/digital.hpp b/include/dsp/digital.hpp index 14713d54..f8ae1af3 100644 --- a/include/dsp/digital.hpp +++ b/include/dsp/digital.hpp @@ -172,7 +172,7 @@ struct PulseGenerator { remaining = 0.f; } - /** Advances the state by `deltaTime`. Returns whether the pulse is in the HIGH state. */ + /** Advances the state by `deltaTime`. Returns whether the pulse was in the HIGH state before stepping. */ bool process(float deltaTime) { if (remaining > 0.f) { remaining -= deltaTime; @@ -181,6 +181,10 @@ struct PulseGenerator { return false; } + bool isHigh() { + return (remaining > 0.f); + } + /** Begins a trigger with the given `duration`. */ void trigger(float duration = 1e-3f) { // Keep the previous pulse if the existing pulse will be held longer than the currently requested one.