thru options 2.0

super midi thru object with loads of options!
Author: Mattilyn Mattroe
License: You have to listen to madvilliany twice every time you use this object at a gig
Github: matroe/midi/thru options 2.0.axo

Inlets

None

Outlets

None

Attributes

combo input

combo output

combo notes

combo ccs

combo clock

combo ChPressure

combo PolyPressure

combo ProgramCh

combo bend

spinner inchannel

spinner outchannel

spinner lowestnote

spinner highestnote

Midi Handler
if (attr_input) {
  uint8_t status_type = status;
  if (attr_ccs) {
    if ((status_type == MIDI_CONTROL_CHANGE + (attr_inchannel - 1))) {
      MidiSend3((midi_device_t)attr_output,
                status_type + ((attr_outchannel - 1) - (attr_inchannel - 1)),
                data1, data2);
    }
  }
  if (attr_notes) {
    if (((status_type == MIDI_NOTE_OFF + (attr_inchannel - 1)) &&
         (data1 >= attr_lowestnote) && (data1 <= attr_highestnote)) ||
        ((status_type == MIDI_NOTE_ON + (attr_inchannel - 1)) &&
         (data1 >= attr_lowestnote) && (data1 <= attr_highestnote))) {
      MidiSend3((midi_device_t)attr_output,
                status_type + ((attr_outchannel - 1) - (attr_inchannel - 1)),
                data1, data2);
    }
  }
  if (attr_bend) {
    if (status_type == MIDI_PITCH_BEND + (attr_inchannel - 1)) {
      MidiSend3((midi_device_t)attr_output,
                status_type + ((attr_outchannel - 1) - (attr_inchannel - 1)),
                data1, data2);
    }
  }
  if (attr_clock) {
    if ((status == MIDI_TIMING_CLOCK) || (status == MIDI_START) ||
        (status == MIDI_CONTINUE) || (status == MIDI_STOP)) {
      MidiSend1((midi_device_t)attr_output, status);
    }
  }

  if (attr_PolyPressure) {
    if ((status_type == MIDI_POLY_PRESSURE + (attr_inchannel - 1)) &&
        (data1 >= attr_lowestnote) && (data1 <= attr_highestnote)) {

      MidiSend3((midi_device_t)attr_output,
                status_type + ((attr_outchannel - 1) - (attr_inchannel - 1)),
                data1, data2);
    }
  }
  if (attr_ProgramCh) {
    if (status_type == MIDI_PROGRAM_CHANGE + (attr_inchannel - 1)) {

      MidiSend2((midi_device_t)attr_output,
                status_type + ((attr_outchannel - 1) - (attr_inchannel - 1)),
                data1);
    }
  }
  if (attr_ChPressure) {
    if (status_type == MIDI_CHANNEL_PRESSURE + (attr_inchannel - 1)) {
      MidiSend2((midi_device_t)attr_output,
                status_type + ((attr_outchannel - 1) - (attr_inchannel - 1)),
                data1);
    }
  }
}

Privacy

© 2024 Zrna Research