led value u 2 bar

Author:
License: GPL
Github: rbrt/push/led value u 2 bar.axo

Inlets

frac32.positive in

Outlets

charptr32 out

bool32.pulse trig

Declaration
char out[9];
int8_t v;
int8_t prev;
int8_t fb;
int16_t nb;
Init
#define BARS_ONE_L 0x03
#define BARS_ONE_R 0x04
#define BARS_TWO 0x05
#define BARS_NONE 0x06
Control Rate
outlet_trig = 0;
v = inlet_in >> 20;
if (v != prev) {
  if (v <= 0)
    v = 0;
  memset(out, BARS_NONE, 8);
  nb = ((v + 1) << 4) >> 7;
  fb = nb >> 1;
  memset(out, BARS_TWO, fb);
  if (nb % 2)
    out[fb] = BARS_ONE_L;
  prev = v;
  outlet_trig = 1;
}

outlet_out = out;

Privacy

© 2024 Zrna Research