If in > hi, output 1. If in < lo, output 0. Otherwise, repeat the last sample of output, assumed to be 0 at initialization. In sclang-flavored pseudocode:
in > hi
in < lo
Signal to be tested.
Low threshold.
High threshold.