void app_midi_event(u8 port, u8 status, u8 d1, u8 d2) { // example - MIDI interface functionality for USB "MIDI" port -> DIN port if (port == USBMIDI) { hal_send_midi(DINMIDI, status, d1, d2); } // // example -MIDI interface functionality for DIN -> USB "MIDI" port port if (port == DINMIDI) { hal_send_midi(USBMIDI, status, d1, d2); } }
void app_aftertouch_event(u8 index, u8 value) { // example - send poly aftertouch to MIDI ports hal_send_midi(USBMIDI, POLYAFTERTOUCH | 0, index, value); // example - set LED to white, brightness in proportion to pressure hal_plot_led(TYPEPAD, index, value/2, value/2, value/2); }
void app_timer_event() { // example - send MIDI clock at 125bpm #define TICK_MS 20 static u8 ms = TICK_MS; if (++ms >= TICK_MS) { ms = 0; // send a clock pulse up the USB hal_send_midi(USBSTANDALONE, MIDITIMINGCLOCK, 0, 0); } }
void app_surface_event(u8 type, u8 index, u8 value) { switch (type) { case TYPEPAD: { // example - light / extinguish pad LEDs, send MIDI hal_plot_led(TYPEPAD, index, value, value, value); hal_send_midi(DINMIDI, NOTEON | 0, index, value); } break; case TYPESETUP: { // example - light the setup LED hal_plot_led(TYPESETUP, 0, value, value, value); } break; } }
void app_midi_event(u8 port, u8 status, u8 d1, u8 d2) { // no pass through for now. I suspect that this might be responsible for the occasional // crash in the midi handling I saw // example - MIDI interface functionality for USB "MIDI" port -> DIN port if ((port == USBMIDI) && (mode == MODE_USER)) { hal_send_midi(DINMIDI, status, d1, d2); } /* // example -MIDI interface functionality for DIN -> USB "MIDI" port port if (port == DINMIDI) { hal_send_midi(USBMIDI, status, d1, d2); } */ switch(status) { case MIDISTART: { midiStart(); } case MIDICONTINUE: { midiContinue(); } break; case MIDISTOP: { midiStop(); } break; case MIDITIMINGCLOCK: // handle MIDI clock ticks { midiTick(); } break; default: break; } }