led row v u

Author:
License: GPL
Github: rbrt/testing/led row v u.axo

Inlets

frac32.positive v0

frac32.positive v1

frac32.positive v2

frac32.positive v3

frac32.positive v4

frac32.positive v5

frac32.positive v6

frac32.positive v7

bool32.risingfalling mute

bool32.rising redraw

int32 row

Outlets

None

Attributes

objref LED

Declaration
bool trig;
bool mtrig;

int8_t fb;
int16_t nb;

uint8_t prerow;
uint8_t count;

int32_t in[8];
int32_t prev[8];
int32_t v;

int i;
int ii;
bool doit;
Init
#define BARS_ONE_L 0x03
#define BARS_ONE_R 0x04
#define BARS_TWO 0x05
#define BARS_NONE 0x06
Control Rate
if (!inlet_mute) {
  in[0] = inlet_v0;
  in[1] = inlet_v1;
  in[2] = inlet_v2;
  in[3] = inlet_v3;
  in[4] = inlet_v4;
  in[5] = inlet_v5;
  in[6] = inlet_v6;
  in[7] = inlet_v7;

  if (in[count] != prev[count]) {
    prev[count] = in[count];
    doit = 1;
  }
  if (inlet_redraw && !trig) {
    trig = 1;
    doit = 1;
  }
  if (!inlet_mute && !mtrig) {
    mtrig = 1;
    doit = 1;
  }
  if (inlet_row != prerow) {
    doit = 1;
    prerow = inlet_row;
  }

  if (doit && !attr_LED.BUSY) {
    doit = 0;
    for (i = 0; i < 8; i++) {
      v = in[i];
      if (v <= 0)
        v = 0;
      for (ii = 0; ii < 8; ii++)
        attr_LED.array[ii + attr_LED.CELLOFFSET[i] + (inlet_row * 68)] =
            BARS_NONE;
      nb = (((v >> 20) + 1) << 4) >> 7;
      fb = nb >> 1;
      for (ii = 0; ii < fb; ii++)
        attr_LED.array[ii + attr_LED.CELLOFFSET[i] + (inlet_row * 68)] =
            BARS_TWO;
      if (nb % 2)
        attr_LED.array[fb + attr_LED.CELLOFFSET[i] + (inlet_row * 68)] =
            BARS_ONE_L;
    }
    attr_LED.DIRTY = 1;
  }
  count++;
  count = count % 8;
}
if (!inlet_redraw)
  trig = 0;
if (inlet_mute)
  mtrig = 0;

Privacy

© 2024 Zrna Research