Explorar el Código

Support receiving longer MIDI sysex on Teensy 3.1+

teensy4-core
PaulStoffregen hace 7 años
padre
commit
0c20722121
Se han modificado 2 ficheros con 9 adiciones y 3 borrados
  1. +2
    -1
      teensy3/usb_midi.c
  2. +7
    -2
      teensy3/usb_midi.h

+ 2
- 1
teensy3/usb_midi.c Ver fichero

@@ -41,7 +41,7 @@ uint8_t usb_midi_msg_type;
uint8_t usb_midi_msg_data1;
uint8_t usb_midi_msg_data2;
uint8_t usb_midi_msg_sysex[USB_MIDI_SYSEX_MAX];
uint8_t usb_midi_msg_sysex_len;
uint16_t usb_midi_msg_sysex_len;
void (*usb_midi_handleNoteOff)(uint8_t ch, uint8_t note, uint8_t vel) = NULL;
void (*usb_midi_handleNoteOn)(uint8_t ch, uint8_t note, uint8_t vel) = NULL;
void (*usb_midi_handleVelocityChange)(uint8_t ch, uint8_t note, uint8_t vel) = NULL;
@@ -307,6 +307,7 @@ int usb_midi_read(uint32_t channel)
if (type1 >= 0x06) sysex_byte(n >> 16);
if (type1 == 0x07) sysex_byte(n >> 24);
usb_midi_msg_data1 = usb_midi_msg_sysex_len;
usb_midi_msg_data2 = usb_midi_msg_sysex_len >> 8;
usb_midi_msg_sysex_len = 0;
usb_midi_msg_type = 7; // 7 = Sys Ex
if (usb_midi_handleSysEx)

+ 7
- 2
teensy3/usb_midi.h Ver fichero

@@ -56,7 +56,12 @@ used together without conflict.
#define SystemExclusive 7
*/

#define USB_MIDI_SYSEX_MAX 60 // maximum sysex length we can receive
// maximum sysex length we can receive
#if defined(__MKL26Z64__) || defined(__MK20DX128__)
#define USB_MIDI_SYSEX_MAX 60
#else
#define USB_MIDI_SYSEX_MAX 290
#endif

// C language implementation
#ifdef __cplusplus
@@ -73,7 +78,7 @@ extern uint8_t usb_midi_msg_type;
extern uint8_t usb_midi_msg_data1;
extern uint8_t usb_midi_msg_data2;
extern uint8_t usb_midi_msg_sysex[USB_MIDI_SYSEX_MAX];
extern uint8_t usb_midi_msg_sysex_len;
extern uint16_t usb_midi_msg_sysex_len;
extern void (*usb_midi_handleNoteOff)(uint8_t ch, uint8_t note, uint8_t vel);
extern void (*usb_midi_handleNoteOn)(uint8_t ch, uint8_t note, uint8_t vel);
extern void (*usb_midi_handleVelocityChange)(uint8_t ch, uint8_t note, uint8_t vel);

Cargando…
Cancelar
Guardar