瀏覽代碼

Support receiving longer MIDI sysex on Teensy 3.1+

main
PaulStoffregen 6 年之前
父節點
當前提交
0c20722121
共有 2 個文件被更改,包括 9 次插入3 次删除
  1. +2
    -1
      teensy3/usb_midi.c
  2. +7
    -2
      teensy3/usb_midi.h

+ 2
- 1
teensy3/usb_midi.c 查看文件

@@ -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 查看文件

@@ -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);

Loading…
取消
儲存