bool32.risingfalling mute
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 mode0
bool32 mode1
bool32 mode2
bool32 mode3
bool32 mode4
bool32 mode5
bool32 mode6
bool32 mode7
bool32.rising redraw
int32 row
None
objref LEDmaster
spinner row
bool trig;
bool mtrig;
int8_t fb;
int16_t nb;
uint8_t prerow;
uint8_t count;
int8_t in[8];
int8_t prev[8];
bool mode[8];
bool premode[8];
int8_t v;
bool doit;
bool update;
uint8_t row;
uint16_t offset;
#define BARS_ONE_L 0x03
#define BARS_ONE_R 0x04
#define BARS_TWO 0x05
#define BARS_NONE 0x06
if (!inlet_mute && !mtrig) {
mtrig = 1;
update = 1;
count = 0;
}
if (inlet_mute)
mtrig = 0;
if (!inlet_mute) {
in[0] = inlet_v0 >> 20;
in[1] = inlet_v1 >> 20;
in[2] = inlet_v2 >> 20;
in[3] = inlet_v3 >> 20;
in[4] = inlet_v4 >> 20;
in[5] = inlet_v5 >> 20;
in[6] = inlet_v6 >> 20;
in[7] = inlet_v7 >> 20;
mode[0] = inlet_mode0;
mode[1] = inlet_mode1;
mode[2] = inlet_mode2;
mode[3] = inlet_mode3;
mode[4] = inlet_mode4;
mode[5] = inlet_mode5;
mode[6] = inlet_mode6;
mode[7] = inlet_mode7;
row = (inlet_row + attr_row) % 4;
if (inlet_redraw && !trig) {
trig = 1;
update = 1;
count = 0;
}
if (!inlet_redraw)
trig = 0;
if (row != prerow) {
prerow = row;
update = 1;
count = 0;
}
if (mode[count] != premode[count]) {
premode[count] = mode[count];
update = 1;
count = 0;
}
offset = attr_LEDmaster.array[count + 308] + (row * 77);
v = in[count];
if ((v != prev[count]) || update) {
prev[count] = v;
if (!mode[count]) {
if (v <= 0)
v = 0;
memset(attr_LEDmaster.array + offset, BARS_NONE, 8);
nb = ((v + 1) << 4) >> 7;
fb = nb >> 1;
memset(attr_LEDmaster.array + offset, BARS_TWO, fb);
if (nb % 2)
attr_LEDmaster.array[fb + offset] = BARS_ONE_L;
} else {
v = (v >> 1) + 64;
memset(attr_LEDmaster.array + offset, BARS_NONE, 8);
if (v == 64) {
attr_LEDmaster.array[4 + offset] = 60;
attr_LEDmaster.array[3 + offset] = 62;
}
if (v > 64) {
attr_LEDmaster.array[3 + offset] = 62;
nb = (((v + 1) << 4) >> 7) - 8;
fb = nb >> 1;
memset(attr_LEDmaster.array + offset + 4, BARS_TWO, fb);
if (nb % 2)
attr_LEDmaster.array[fb + 4 + offset] = BARS_ONE_L;
}
if (v < 64) {
attr_LEDmaster.array[4 + offset] = 60;
nb = 8 - (((v + 6) << 4) >> 7);
fb = nb >> 1;
memset(attr_LEDmaster.array + offset + (4 - fb), BARS_TWO, fb);
if (nb % 2)
attr_LEDmaster.array[offset + 3 - fb] = BARS_ONE_R;
}
}
doit = 1;
}
if ((doit && !attr_LEDmaster.ROW) && !attr_LEDmaster.LOCKED) {
attr_LEDmaster.ROW = row + 1;
doit = 0;
}
count++;
count = count % 8;
if (!count)
update = 0;
}