left block 2 set

Author:
License: GPL
Github: rbrt/push/left block 2 set.axo

Inlets

int32.positive b0

int32.positive b1

int32.positive b2

int32.positive b3

Outlets

None

Declaration
uint8_t prev[4];
uint8_t in[4];
uint8_t doit;
uint8_t count;
int i;
Control Rate
in[3] = inlet_b0;
in[2] = inlet_b1;
in[1] = inlet_b2;
in[0] = inlet_b3;

if (!doit && !count) {
  for (i = 0; i < 4; i++) {
    if (in[i] != prev[i]) {
      doit = i + 1;
      break;
    }
  }
}

if (doit && !MidiGetOutputBufferPending(MIDI_DEVICE_USB_HOST)) {
  MidiSend3(MIDI_DEVICE_USB_HOST, 2, MIDI_CONTROL_CHANGE, doit + 115,
            in[doit - 1]);
  prev[doit - 1] = in[doit - 1];
  doit = 0;
  count = 50;
}
if (count)
  count--;

Privacy

© 2024 Zrna Research