accum

accumulator.adds '1' on trigger. Reset clears the accumulator to zero.
Author: Robert Schirmer
License: BSD
Github: rbrt/math/accum.axo

Inlets

bool32.rising trigger

bool32.rising reset

Outlets

int32 o

Declaration
int ntrig;
int rtrig;
int accu;
Init
ntrig = 0;
rtrig = 0;
accu = 0;
Control Rate
if ((inlet_trig) && !ntrig) {
  accu += 1;
  ntrig = 1;
}
if (!inlet_trig)
  ntrig = 0;
if ((inlet_rst) && !rtrig) {
  accu = 0;
  rtrig = 1;
}
if (!inlet_rst)
  rtrig = 0;
outlet_o = accu;

Privacy

© 2024 Zrna Research