| @@ -172,7 +172,7 @@ struct PulseGenerator { | |||||
| remaining = 0.f; | 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) { | bool process(float deltaTime) { | ||||
| if (remaining > 0.f) { | if (remaining > 0.f) { | ||||
| remaining -= deltaTime; | remaining -= deltaTime; | ||||
| @@ -181,6 +181,10 @@ struct PulseGenerator { | |||||
| return false; | return false; | ||||
| } | } | ||||
| bool isHigh() { | |||||
| return (remaining > 0.f); | |||||
| } | |||||
| /** Begins a trigger with the given `duration`. */ | /** Begins a trigger with the given `duration`. */ | ||||
| void trigger(float duration = 1e-3f) { | void trigger(float duration = 1e-3f) { | ||||
| // Keep the previous pulse if the existing pulse will be held longer than the currently requested one. | // Keep the previous pulse if the existing pulse will be held longer than the currently requested one. | ||||