procCC74

MPE: moves the "pre-noteOn" CC74 to first "post-noteOn". Use it with "tiar/midi/mpe sbrd rise" (initTimbreMode:post noteOn) in a patcher/patch with midi selector set to internal device set to the corresponding port.
Author: Smashed Transistors
License: LGPL
Github: tiar/midi/in/procCC74.axo

Inlets

None

Outlets

None

Attributes

combo device

Declaration
uint8_t CC74[16];
Init
for (int c = 0; c < 16; c++)
  CC74[c] = 0;
Midi Handler
if (dev != (midi_device_t)MIDI_DEVICE_INTERNAL) {
  int channel = status & 0x0F;
  // remember the latest CC74 for every channel
  if ((status & 0xF0) == MIDI_CONTROL_CHANGE && data1 == 74) {
    CC74[channel] = data2;
  }
  // Midi thru
  if (status) {
    PatchMidiInHandler((midi_device_t)attr_device, status, data1, data2);
  }
  // on note on, send the CC74 immediately after
  if ((status & 0xF0) == MIDI_NOTE_ON && data2 != 0) {
    //	LogTextMessage("NoteOn ->CtrlChange ch%2D n%3D v%3D", 1 + channel, 74,
    //CC74[channel]);
    PatchMidiInHandler((midi_device_t)attr_device,
                       MIDI_CONTROL_CHANGE + channel, 74, CC74[channel]);
  }
}

Privacy

© 2024 Zrna Research