bool32 up
bool32 down
bool32 trig
frac32 a+1
int _state;
bool _busy;
int _highthres = 6;
int _lowthres = -4;
int _delay;
bool _trig;
_state = 0;
_busy = 0;
_delay = 0;
_trig = 0;
if (_busy == 0 && _delay > 1000) {
if ((inlet_up == 1) && (_state + 1 < _highthres)) {
if (inlet_down == 1) {
_trig = 1;
} else {
_state = _state + 1;
_busy = 1;
_delay = 0;
LogTextMessage("%d", _state);
}
}
if ((inlet_down == 1) && (_state - 1 > _lowthres)) {
_state = _state - 1;
_busy = 1;
_delay = 0;
LogTextMessage("%d", _state);
}
} else {
if ((inlet_up == 0) && (inlet_down == 0)) {
_busy = 0;
_trig = 0;
}
}
_delay++;
// outlet_result= inlet_a+((12*_state)<<21);
outlet_result = ((12 * _state) << 21);
outlet_trig = _trig;