Hi,
I'm beginning with PD so please bear with me
I'm trying to translate an existing application to PD, and having difficulties with a certain part.
In general, the application applies a filter when the input level is above a certain threshold. When it goes below the threshold, it waits for some time and stops applying the filter.
So there are three possible states: Normal, Wait, Stop. Here's a short pseudo-code to describe the state change logic:
if (level >= threshold) {
state = Normal
}
else if (state == Normal) {
TimerBegin()
state = Wait
}
else if (state == Wait) {
if (TimerElapsed() > waitTime) {
state = Stop
}
}
Afterwards, the state is used to determine whether to activate a filter:
if (state != Stop) {
ApplyFilter()
}
What is the correct approach to implement this in PD? I understand that I need to use
Thanks!