speedlim

useful for data thinning (for example de-bouncing buttons). limits the throughput of data to an interval specified by the dial 'd' (in ms)
Author: Robert Schirmer
License: who cares
Github: rbrt/control/speedlim.axo

Inlets

frac32 in

Outlets

frac32 out

Parameters

frac32.s.map.klineartime.exp2 d

Declaration
int ptrig;
int32_t pval;
bool trig;
Init
ptrig = 0;
pval = 0;
Control Rate
if ((pval != inlet_in) & (!ptrig)) {
  outlet_out = inlet_in;
  pval = inlet_in;
  ptrig = 1 << 27;
} else {
  if (ptrig > 0) {
    ptrig -= param_d >> 4;
  } else
    ptrig = 0;
  outlet_out = pval;
}

Privacy

© 2024 Zrna Research