lsync new

if 'wait' is high,'loop_sync' will wait until the signal at 'pos' reaches the value defined by 'start'. then, a pulse is put out at outlet 'trig'.
Author: robert schirmer
License: BSD
Github: rbrt/testing/lsync new.axo

Inlets

bool32.rising wait

bool32.rising stop

frac32.positive pos

frac32.positive sync position

Outlets

bool32.pulse sync trigger

bool32 wait

Declaration
int shift;
bool wait;
Init
shift = 1 << 18;
Control Rate
int csample = inlet_pos;
int spos = inlet_start;

if (inlet_wait && !wait)
  wait = 1;

if (wait && ((csample > (spos - shift)) && (csample < (spos + shift)))) {
  outlet_trig = 1;
  wait = 0;
} else
  outlet_trig = 0;

if (wait && inlet_stop)
  wait = 0;

outlet_wait = wait;

Privacy

© 2024 Zrna Research