trigger 2

useful to trigger events in strict order to overcome execution-order troubles. optionally,with a delay in k-rate ticks in between events. similar to max/msp 'trigger bang'
Author: Robert Schirmer
License: BSD
Github: rbrt/control/trigger 2.axo

Inlets

bool32.rising trig

Outlets

bool32.pulse t1

bool32.pulse t2

Attributes

spinner delay

Declaration
int count;
bool ntrig;
bool go;
Init
count = -1;
Control Rate
if (inlet_trig && !ntrig) {
  ntrig = 1;
  count = -1;
  go = 1;
}

if (go)
  count += 1;

if (count == 0)
  outlet_t1 = 1;
else
  outlet_t1 = 0;

if (count == attr_delay)
  outlet_t2 = 1;
else
  outlet_t2 = 0;

if (count > attr_delay) {
  go = 0;
  if (!inlet_trig)
    ntrig = 0;
}

Privacy

© 2024 Zrna Research