matrix clear

clear an area of the 8x8 button matrix on a 'novation launchpad'
Author: Robert Schirmer
License: BSD
Github: rbrt/launchpad/matrix clear.axo

Inlets

bool32.rising clear

int32 start

int32 length

Outlets

None

Parameters

int32 length of the area to display

int32 display start on the LP

Attributes

combo device

Declaration
int ntrig;
uint8_t map[64];
int i;
int length;
Init
{
  int i;
  for (i = 0; i < 64; i++)
    map[i] = (((i >> 3) << 3) + i);
}

i = 666;
Control Rate
length = ((inlet_length + param_length + inlet_start + param_start) > 64)
             ? 64
             : (inlet_length + param_length);

// clear
if ((inlet_clear > 0) && !ntrig) {
  ntrig = 1;
  i = 0;
}

if (i < length) {
  MidiSend3((midi_device_t)attr_device, MIDI_NOTE_ON,
            map[(i + (inlet_start + param_start))], 0);
  i += 1;
} else
  i = 666;
if (!(inlet_clear > 0))
  ntrig = 0;

Privacy

© 2024 Zrna Research