trigger 4

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 4.axo

Inlets

bool32.rising trig

Outlets

bool32.pulse t1

bool32.pulse t2

bool32.pulse t3

bool32.pulse t4

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 == (1 * attr_delay))
  outlet_t2 = 1;
else
  outlet_t2 = 0;

if (count == (2 * attr_delay))
  outlet_t3 = 1;
else
  outlet_t3 = 0;

if (count == (3 * attr_delay))
  outlet_t4 = 1;
else
  outlet_t4 = 0;

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

Privacy

© 2024 Zrna Research