click hold S

detect how long a momentary button is held down; 3 stages,no hold,short hold,long hold. outputs a pulse at the respective outlet on release of the button and the current stage (1 - short hold , 2 - long hold ) out of 'stage'
Author: Robert Schirmer
License: BSD
Github: rbrt/control/click hold S.axo

Inlets

bool32.risingfalling gate

Outlets

bool32.pulse < short (if gate == 0)

bool32.pulse > long and < cancel

int32 current stage

Attributes

spinner long hold start and short hold end,k-ticks

Declaration
int tc;
Control Rate
outlet_short = 0;
outlet_long = 0;

if (inlet_gate) {
  tc++;
  if (tc < attr_long)
    outlet_stage = 1;
  else
    outlet_stage = 2;
  if (tc == attr_long)
    outlet_long = 1;
} else
  outlet_stage = 0;

if (!inlet_gate && tc) {
  if (tc < attr_long)
    outlet_short = 1;
  tc = 0;
}

Privacy

© 2024 Zrna Research