led cell value u

Author:
License: GPL
Github: rbrt/testing/led cell value u.axo

Inlets

frac32.positive in

bool32.risingfalling mute

Outlets

None

Attributes

spinner row

spinner column

objref LED

Declaration
int32_t v;
int32_t prev;
bool mtrig;
bool doit;
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
if (!inlet_mute) {
  v = inlet_in;
  if (!inlet_mute && !mtrig) {
    mtrig = 1;
    doit = 1;
  }
  if (v != prev)
    doit = 1;
  if (doit && !attr_LED.ROW) {
    if (v <= 0)
      v = 0;
    prev = v;
    doit = 0;
    memset(attr_LED.array + attr_LED.CELLOFFSET[attr_column] + (attr_row * 68),
           BARS_NONE, 8);
    nb = (((v >> 20) + 1) << 4) >> 7;
    fb = nb >> 1;
    memset(attr_LED.array + attr_LED.CELLOFFSET[attr_column] + (attr_row * 68),
           BARS_TWO, fb);
    if (nb % 2)
      attr_LED.array[fb + attr_LED.CELLOFFSET[attr_column] + (attr_row * 68)] =
          BARS_ONE_L;
    attr_LED.ROW = attr_row + 1;
  }
}
if (inlet_mute)
  mtrig = 0;

Privacy

© 2024 Zrna Research