midimux 3

collects 3 midi-streams into one. each stream can be muted. buttons 'muteNoteOnOnly' set whether all messages of an input stream or muted or only note-ons.
Author: Robert Schirmer
License: BSD
Github: rbrt/poly/midimux 3.axo

Inlets

bool32.risingfalling mute1

bool32.risingfalling muteOnOnly1

bool32.risingfalling mute2

bool32.risingfalling muteOnOnly2

bool32.risingfalling mute3

bool32.risingfalling muteOnOnly3

int32.positive note1

int32.positive velo1

int32.positive note2

int32.positive velo2

int32.positive note3

int32.positive velo3

Outlets

int32.positive note

int32.positive velo

Declaration
uint8_t nin[3];
uint8_t vin[3];

uint8_t pren[3];
uint8_t prev[3];

uint8_t nstack[8] = {0};
uint8_t vstack[8] = {0};
uint8_t slength;
uint8_t swrite;
uint8_t sread;

uint8_t noteout;
uint8_t veloout;
Control Rate
if (!inlet_mute1) {
  nin[0] = inlet_note1;
  vin[0] = inlet_velo1;
} else if ((!inlet_velo1) && inlet_muteOnOnly1) {
  nin[0] = inlet_note1;
  vin[0] = 0;
}

if (!inlet_mute2) {
  nin[1] = inlet_note2;
  vin[1] = inlet_velo2;
} else if ((!inlet_velo1) && inlet_muteOnOnly2) {
  nin[1] = inlet_note2;
  vin[1] = 0;
}

if (!inlet_mute3) {
  nin[2] = inlet_note3;
  vin[2] = inlet_velo3;
} else if ((!inlet_velo3) && inlet_muteOnOnly3) {
  nin[2] = inlet_note3;
  vin[2] = 0;
}

int i;
for (i = 0; i < 3; i++) {
  if ((nin[i] != pren[i]) || (vin[i] != prev[i])) {
    nstack[swrite] = nin[i];
    vstack[swrite] = vin[i];
    pren[i] = nin[i];
    prev[i] = vin[i];
    slength++;
    swrite++;
    swrite = swrite % 8;
  }
}

if (slength) {
  noteout = nstack[sread];
  veloout = vstack[sread];
  sread++;
  sread = sread % 8;
  slength--;
}

outlet_note = noteout;
outlet_velo = veloout;

Privacy

© 2024 Zrna Research