28 bool triggered = (
s ==
LOW) && in;
45 else if (
s ==
HIGH && !in) {
60template <
typename T =
float>
69 T
process(T in, T lowThreshold = 0.f, T highThreshold = 1.f) {
70 T on = (in >= highThreshold);
71 T off = (in <= lowThreshold);
69 T
process(T in, T lowThreshold = 0.f, T highThreshold = 1.f) {
…}
107 bool process(
float in,
float lowThreshold = 0.f,
float highThreshold = 1.f) {
108 if (
s ==
LOW && in >= highThreshold) {
113 else if (
s ==
HIGH && in <= lowThreshold) {
107 bool process(
float in,
float lowThreshold = 0.f,
float highThreshold = 1.f) {
…}
137 if (
s ==
LOW && in >= highThreshold) {
142 else if (
s ==
HIGH && in <= lowThreshold) {
199template <
typename T =
float>
Digital signal processing routines and classes.
Definition approx.hpp:6
TTimer Timer
Definition digital.hpp:218
TSchmittTrigger SchmittTrigger
Definition digital.hpp:163
Deprecated Rack v1 event namespace.
Definition Widget.hpp:531
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
Detects when a boolean changes from false to true.
Definition digital.hpp:10
bool state
Deprecated.
Definition digital.hpp:19
void reset()
Definition digital.hpp:22
bool process(bool in)
Returns whether the input changed from false to true.
Definition digital.hpp:27
bool isHigh()
Definition digital.hpp:52
State s
Definition digital.hpp:17
Event
Definition digital.hpp:33
@ UNTRIGGERED
Definition digital.hpp:36
@ TRIGGERED
Definition digital.hpp:35
@ NONE
Definition digital.hpp:34
State
Definition digital.hpp:11
@ HIGH
Definition digital.hpp:13
@ UNINITIALIZED
Definition digital.hpp:14
@ LOW
Definition digital.hpp:12
Event processEvent(bool in)
Returns TRIGGERED if the input changed from false to true, and UNTRIGGERED if the input changed from ...
Definition digital.hpp:40
Counts calls to process(), returning true every division calls.
Definition digital.hpp:228
bool process()
Returns true when the clock reaches division and resets.
Definition digital.hpp:249
uint32_t getDivision()
Definition digital.hpp:240
uint32_t getClock()
Definition digital.hpp:244
void setDivision(uint32_t division)
Definition digital.hpp:236
uint32_t clock
Definition digital.hpp:229
void reset()
Definition digital.hpp:232
uint32_t division
Definition digital.hpp:230
When triggered, holds a high value for a specified time before going low again.
Definition digital.hpp:167
bool isHigh()
Definition digital.hpp:184
void reset()
Immediately disables the pulse.
Definition digital.hpp:171
float remaining
Definition digital.hpp:168
void trigger(float duration=1e-3f)
Begins a trigger with the given duration.
Definition digital.hpp:189
bool process(float deltaTime)
Advances the state by deltaTime.
Definition digital.hpp:176
State
Definition digital.hpp:84
@ LOW
Definition digital.hpp:85
@ HIGH
Definition digital.hpp:86
@ UNINITIALIZED
Definition digital.hpp:87
bool isHigh()
Definition digital.hpp:158
void reset()
Definition digital.hpp:95
Event processEvent(float in, float lowThreshold=0.f, float highThreshold=1.f)
Returns TRIGGERED if the input reached highThreshold, and UNTRIGGERED if the input reached lowThresho...
Definition digital.hpp:135
State s
Definition digital.hpp:90
bool state
Deprecated.
Definition digital.hpp:92
Event
Definition digital.hpp:128
@ UNTRIGGERED
Definition digital.hpp:131
@ NONE
Definition digital.hpp:129
@ TRIGGERED
Definition digital.hpp:130
bool process(float in, float lowThreshold=0.f, float highThreshold=1.f)
Updates the state of the Schmitt Trigger given a value.
Definition digital.hpp:107
Turns HIGH when value reaches a threshold (default 0.f), turns LOW when value reaches a threshold (de...
Definition digital.hpp:61
T isHigh()
Definition digital.hpp:76
void reset()
Definition digital.hpp:66
T state
Definition digital.hpp:62
TSchmittTrigger()
Definition digital.hpp:63
T process(T in, T lowThreshold=0.f, T highThreshold=1.f)
Definition digital.hpp:69
Accumulates a timer when process() is called.
Definition digital.hpp:200
T time
Definition digital.hpp:201
void reset()
Definition digital.hpp:203
T getTime()
Definition digital.hpp:213
T process(T deltaTime)
Returns the time since last reset or initialization.
Definition digital.hpp:208