瀏覽代碼

Update Teensy 2.0 with new USB MIDI features

teensy4-core
PaulStoffregen 7 年之前
父節點
當前提交
f6fef86abc
共有 3 個檔案被更改,包括 391 行新增97 行删除
  1. +3
    -0
      teensy3/usb_midi.h
  2. +136
    -63
      usb_midi/usb_api.cpp
  3. +252
    -34
      usb_midi/usb_api.h

+ 3
- 0
teensy3/usb_midi.h 查看文件

@@ -106,6 +106,9 @@ extern void (*usb_midi_handleRealTimeSystem)(uint8_t rtb);
// 24:0 Note off 0, note 62, velocity 0
// 24:0 Note on 0, note 64, velocity 99
// 24:0 Note off 0, note 64, velocity 0
//
// Quick-dirty way to transmit MIDI sysex:
// echo -n -e '\xF0abcd\xF7' > /dev/midi2

// C++ interface
#ifdef __cplusplus

+ 136
- 63
usb_midi/usb_api.cpp 查看文件

@@ -30,38 +30,8 @@
#include "wiring.h"


void usb_midi_class::sendNoteOff(uint8_t note, uint8_t velocity, uint8_t channel)
void usb_midi_class::sendSysEx_BufferHasTerm(uint16_t length, const uint8_t *data)
{
send_raw(0x08, 0x80 | ((channel - 1) & 0x0F), note & 0x7F, velocity & 0x7F);
}
void usb_midi_class::sendNoteOn(uint8_t note, uint8_t velocity, uint8_t channel)
{
send_raw(0x09, 0x90 | ((channel - 1) & 0x0F), note & 0x7F, velocity & 0x7F);
}
void usb_midi_class::sendPolyPressure(uint8_t note, uint8_t pressure, uint8_t channel)
{
send_raw(0x0A, 0xA0 | ((channel - 1) & 0x0F), note & 0x7F, pressure & 0x7F);
}
void usb_midi_class::sendControlChange(uint8_t control, uint8_t value, uint8_t channel)
{
send_raw(0x0B, 0xB0 | ((channel - 1) & 0x0F), control & 0x7F, value & 0x7F);
}
void usb_midi_class::sendProgramChange(uint8_t program, uint8_t channel)
{
send_raw(0x0C, 0xC0 | ((channel - 1) & 0x0F), program & 0x7F, 0);
}
void usb_midi_class::sendAfterTouch(uint8_t pressure, uint8_t channel)
{
send_raw(0x0D, 0xD0 | ((channel - 1) & 0x0F), pressure & 0x7F, 0);
}
void usb_midi_class::sendPitchBend(uint16_t value, uint8_t channel)
{
send_raw(0x0E, 0xE0 | ((channel - 1) & 0x0F), value & 0x7F, (value >> 7) & 0x7F);
}

void usb_midi_class::sendSysEx(uint8_t length, const uint8_t *data)
{
// TODO: MIDI 2.5 lib automatically adds start and stop bytes
while (length > 3) {
send_raw(0x04, data[0], data[1], data[2]);
data += 3;
@@ -76,6 +46,33 @@ void usb_midi_class::sendSysEx(uint8_t length, const uint8_t *data)
}
}

void usb_midi_class::sendSysEx_AddTermBytes(uint16_t length, const uint8_t *data)
{
if (length == 0) {
send_raw(0x06, 0xF0, 0xF7, 0);
return;
} else if (length == 1) {
send_raw(0x07, 0xF0, data[0], 0xF7);
return;
} else {
send_raw(0x04, 0xF0, data[0], data[1]);
data += 2;
length -= 2;
}
while (length >= 3) {
send_raw(0x04, data[0], data[1], data[2]);
data += 3;
length -= 3;
}
if (length == 2) {
send_raw(0x07, data[0], data[1], 0xF7);
} else if (length == 1) {
send_raw(0x06, data[0], 0xF7, 0);
} else {
send_raw(0x05, 0xF7, 0, 0);
}
}

void usb_midi_class::send_raw(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3)
{
uint8_t intr_state, timeout;
@@ -211,47 +208,41 @@ bool usb_midi_class::read(uint8_t channel)
return false;
}
if (type1 == 0x08 && type2 == 0x80) {
msg_type = 0; // Note off
msg_type = 0x80; // 0x80 = usbMIDI.NoteOff
if (handleNoteOff) (*handleNoteOff)(c, b2, b3);
goto return_message;
}
} else
if (type1 == 0x09 && type2 == 0x90) {
if (b3) {
msg_type = 1; // Note on
msg_type = 0x90; // 0x90 = usbMIDI.NoteOn
if (handleNoteOn) (*handleNoteOn)(c, b2, b3);
} else {
msg_type = 0; // Note off
msg_type = 0x80; // 0x80 = usbMIDI.NoteOff
if (handleNoteOff) (*handleNoteOff)(c, b2, b3);
}
goto return_message;
}
} else
if (type1 == 0x0A && type2 == 0xA0) {
msg_type = 2; // Poly Pressure
msg_type = 0xA0; // 0xA0 = usbMIDI.AfterTouchPoly
if (handleVelocityChange) (*handleVelocityChange)(c, b2, b3);
goto return_message;
}
} else
if (type1 == 0x0B && type2 == 0xB0) {
msg_type = 3; // Control Change
msg_type = 0xB0; // 0xB0 = usbMIDI.ControlChange
if (handleControlChange) (*handleControlChange)(c, b2, b3);
goto return_message;
}
} else
if (type1 == 0x0C && type2 == 0xC0) {
msg_type = 4; // Program Change
msg_type = 0xC0; // 0xC0 = usbMIDI.ProgramChange
if (handleProgramChange) (*handleProgramChange)(c, b2);
goto return_message;
}
} else
if (type1 == 0x0D && type2 == 0xD0) {
msg_type = 5; // After Touch
msg_type = 0xD0; // 0xD0 = usbMIDI.AfterTouchChannel
if (handleAfterTouch) (*handleAfterTouch)(c, b2);
goto return_message;
}
} else
if (type1 == 0x0E && type2 == 0xE0) {
msg_type = 6; // Pitch Bend
msg_type = 0xE0; // 0xE0 = usbMIDI.PitchBend
if (handlePitchChange) (*handlePitchChange)(c,
(b2 & 0x7F) | ((b3 & 0x7F) << 7));
goto return_message;
} else {
return false;
}
return false;
return_message:
// only update these when returning true for a parsed message
// all other return cases will preserve these user-visible values
@@ -260,6 +251,79 @@ bool usb_midi_class::read(uint8_t channel)
msg_data2 = b3;
return true;
}
if (type1 == 0x02 || type1 == 0x03 || (type1 == 0x05 && type2 == 0x0F)) {
// system common or system realtime message
system_common_or_realtime:
switch (b1) {
case 0xF1: // usbMIDI.TimeCodeQuarterFrame
if (handleTimeCodeQuarterFrame) {
(*handleTimeCodeQuarterFrame)(b2);
}
break;
case 0xF2: // usbMIDI.SongPosition
if (handleSongPosition) {
(*handleSongPosition)(
(uint16_t)(b2 & 0x7F) | (uint16_t)(b3 & 0x7F) << 7);
}
break;
case 0xF3: // usbMIDI.SongSelect
if (handleSongSelect) {
(*handleSongSelect)(b2);
}
break;
case 0xF6: // usbMIDI.TuneRequest
if (handleTuneRequest) {
(*handleTuneRequest)();
}
break;
case 0xF8: // usbMIDI.Clock
if (handleClock) {
(*handleClock)();
} else if (handleRealTimeSystem) {
(*handleRealTimeSystem)(0xF8);
}
break;
case 0xFA: // usbMIDI.Start
if (handleStart) {
(*handleStart)();
} else if (handleRealTimeSystem) {
(*handleRealTimeSystem)(0xFA);
}
break;
case 0xFB: // usbMIDI.Continue
if (handleContinue) {
(*handleContinue)();
} else if (handleRealTimeSystem) {
(*handleRealTimeSystem)(0xFB);
}
break;
case 0xFC: // usbMIDI.Stop
if (handleStop) {
(*handleStop)();
} else if (handleRealTimeSystem) {
(*handleRealTimeSystem)(0xFC);
}
break;
case 0xFE: // usbMIDI.ActiveSensing
if (handleActiveSensing) {
(*handleActiveSensing)();
} else if (handleRealTimeSystem) {
(*handleRealTimeSystem)(0xFE);
}
break;
case 0xFF: // usbMIDI.SystemReset
if (handleSystemReset) {
(*handleSystemReset)();
} else if (handleRealTimeSystem) {
(*handleRealTimeSystem)(0xFF);
}
break;
default:
return false; // unknown message, ignore it
}
msg_type = b1;
goto return_message;
}
if (type1 == 0x04) {
read_sysex_byte(b1);
read_sysex_byte(b2);
@@ -270,25 +334,29 @@ bool usb_midi_class::read(uint8_t channel)
read_sysex_byte(b1);
if (type1 >= 0x06) read_sysex_byte(b2);
if (type1 == 0x07) read_sysex_byte(b3);
msg_data1 = msg_sysex_len;
uint16_t len = msg_sysex_len;
msg_data1 = len;
msg_data2 = len >> 8;
msg_sysex_len = 0;
msg_type = 7;
msg_type = 0xF0; // 0xF0 = usbMIDI.SystemExclusive
if (handleSysExPartial) {
(*handleSysExPartial)(msg_sysex, len, 1);
} else if (handleSysExComplete) {
(*handleSysExComplete)(msg_sysex, len);
}
return true;
}
if (type1 == 0x0F) {
// TODO: does this need to be a full MIDI parser?
// What software actually uses this message type in practice?
if (b1 >= 0xF8) {
// From Sebastian Tomczak, seb.tomczak at gmail.com
// http://little-scale.blogspot.com/2011/08/usb-midi-game-boy-sync-for-16.html
goto system_common_or_realtime;
}
if (msg_sysex_len > 0) {
// From David Sorlien, dsorlien at gmail.com, http://axe4live.wordpress.com
// OSX sometimes uses Single Byte Unparsed to
// send bytes in the middle of a SYSEX message.
read_sysex_byte(b1);
} else {
// From Sebastian Tomczak, seb.tomczak at gmail.com
// http://little-scale.blogspot.com/2011/08/usb-midi-game-boy-sync-for-16.html
msg_type = 8;
if (handleRealTimeSystem) (*handleRealTimeSystem)(b1);
goto return_message;
}
}
return false;
@@ -296,6 +364,11 @@ bool usb_midi_class::read(uint8_t channel)

void usb_midi_class::read_sysex_byte(uint8_t b)
{
if (handleSysExPartial && msg_sysex_len >= USB_MIDI_SYSEX_MAX) {
// when buffer is full, send another chunk to partial handler.
(*handleSysExPartial)(msg_sysex, msg_sysex_len, 0);
msg_sysex_len = 0;
}
if (msg_sysex_len < USB_MIDI_SYSEX_MAX) {
msg_sysex[msg_sysex_len++] = b;
}

+ 252
- 34
usb_midi/usb_api.h 查看文件

@@ -29,65 +29,271 @@ used together without conflict.
class usb_midi_class
{
public:
void sendNoteOff(uint8_t note, uint8_t velocity, uint8_t channel);
void sendNoteOn(uint8_t note, uint8_t velocity, uint8_t channel);
void sendPolyPressure(uint8_t note, uint8_t pressure, uint8_t channel);
void sendControlChange(uint8_t control, uint8_t value, uint8_t channel);
void sendProgramChange(uint8_t program, uint8_t channel);
void sendAfterTouch(uint8_t pressure, uint8_t channel);
void sendPitchBend(uint16_t value, uint8_t channel);
void sendSysEx(uint8_t length, const uint8_t *data);
// Message type names for compatibility with Arduino MIDI library 4.3.1
enum MidiType {
InvalidType = 0x00, // For notifying errors
NoteOff = 0x80, // Note Off
NoteOn = 0x90, // Note On
AfterTouchPoly = 0xA0, // Polyphonic AfterTouch
ControlChange = 0xB0, // Control Change / Channel Mode
ProgramChange = 0xC0, // Program Change
AfterTouchChannel = 0xD0, // Channel (monophonic) AfterTouch
PitchBend = 0xE0, // Pitch Bend
SystemExclusive = 0xF0, // System Exclusive
TimeCodeQuarterFrame = 0xF1, // System Common - MIDI Time Code Quarter Frame
SongPosition = 0xF2, // System Common - Song Position Pointer
SongSelect = 0xF3, // System Common - Song Select
TuneRequest = 0xF6, // System Common - Tune Request
Clock = 0xF8, // System Real Time - Timing Clock
Start = 0xFA, // System Real Time - Start
Continue = 0xFB, // System Real Time - Continue
Stop = 0xFC, // System Real Time - Stop
ActiveSensing = 0xFE, // System Real Time - Active Sensing
SystemReset = 0xFF, // System Real Time - System Reset
};
void begin(void) { }
void end(void) { }
void sendNoteOff(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable=0) {
send(0x80, note, velocity, channel, cable);
}
void sendNoteOn(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable=0) {
send(0x90, note, velocity, channel, cable);
}
void sendPolyPressure(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable=0) {
send(0xA0, note, pressure, channel, cable);
}
void sendAfterTouch(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable=0) {
send(0xA0, note, pressure, channel, cable);
}
void sendControlChange(uint8_t control, uint8_t value, uint8_t channel, uint8_t cable=0) {
send(0xB0, control, value, channel, cable);
}
void sendProgramChange(uint8_t program, uint8_t channel, uint8_t cable=0) {
send(0xC0, program, 0, channel, cable);
}
void sendAfterTouch(uint8_t pressure, uint8_t channel, uint8_t cable=0) {
send(0xD0, pressure, 0, channel, cable);
}
void sendPitchBend(uint16_t value, uint8_t channel, uint8_t cable=0) {
// MIDI 4.3 takes -8192 to +8191. We take 0 to 16383
send(0xE0, value, value >> 7, channel, cable);
}
void sendSysEx(uint16_t length, const uint8_t *data, bool hasTerm=false, uint8_t cable=0) {
if (cable > 0) return;
if (hasTerm) {
sendSysEx_BufferHasTerm(length, data);
} else {
sendSysEx_AddTermBytes(length, data);
}
}
void sendRealTime(uint8_t type, uint8_t cable=0) __attribute__((always_inline)) __attribute__((always_inline)) {
switch (type) {
case 0xF8: // Clock
case 0xFA: // Start
case 0xFB: // Continue
case 0xFC: // Stop
case 0xFE: // ActiveSensing
case 0xFF: // SystemReset
send(type, 0, 0, 0, cable);
break;
default: // Invalid Real Time marker
break;
}
}
void sendTimeCodeQuarterFrame(uint8_t type, uint8_t value, uint8_t cable=0) __attribute__((always_inline)) __attribute__((always_inline)) {
send(0xF1, ((type & 0x07) << 4) | (value & 0x0F), 0, 0, cable);
}
void sendSongPosition(uint16_t beats, uint8_t cable=0) __attribute__((always_inline)) {
send(0xF2, beats, beats >> 7, 0, cable);
}
void sendSongSelect(uint8_t song, uint8_t cable=0) __attribute__((always_inline)) {
send(0xF3, song, 0, 0, cable);
}
void sendTuneRequest(uint8_t cable=0) __attribute__((always_inline)) {
send(0xF6, 0, 0, 0, cable);
}
void beginRpn(uint16_t number, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(101, number >> 7, channel, cable);
sendControlChange(100, number, channel, cable);
}
void sendRpnValue(uint16_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(6, value >> 7, channel, cable);
sendControlChange(38, value, channel, cable);
}
void sendRpnValue(uint8_t msb, uint8_t lsb, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(6, msb, channel, cable);
sendControlChange(38, lsb, channel, cable);
}
void sendRpnIncrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(96, amount, channel, cable);
}
void sendRpnDecrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(97, amount, channel, cable);
}
void endRpn(uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(101, 0x7F, channel, cable);
sendControlChange(100, 0x7F, channel, cable);
}
void beginNrpn(uint16_t number, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(99, number >> 7, channel, cable);
sendControlChange(98, number, channel, cable);
}
void sendNrpnValue(uint16_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(6, value >> 7, channel, cable);
sendControlChange(38, value, channel, cable);
}
void sendNrpnValue(uint8_t msb, uint8_t lsb, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(6, msb, channel, cable);
sendControlChange(38, lsb, channel, cable);
}
void sendNrpnIncrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(96, amount, channel, cable);
}
void sendNrpnDecrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(97, amount, channel, cable);
}
void endNrpn(uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) {
sendControlChange(99, 0x7F, channel, cable);
sendControlChange(98, 0x7F, channel, cable);
}
void send(uint8_t type, uint8_t data1, uint8_t data2, uint8_t channel, uint8_t cable) __attribute__((always_inline)) {
if (cable > 0) return;
if (type < 0xF0) {
if (type < 0x80) return;
send_raw(type >> 4, (type & 0xF0) | ((channel - 1) & 0x0F),
data1 & 0x7F, data2 & 0x7F);
} else if (type >= 0xF8 || type == 0xF6) {
send_raw(0x0F, type, 0, 0);
} else if (type == 0xF1 || type == 0xF3) {
send_raw(0x02, type, data1 & 0x7F, 0);
} else if (type == 0xF2) {
send_raw(0x03, type, data1 & 0x7F, data2 & 0x7F);
}
}
void send_now(void);
uint8_t analog2velocity(uint16_t val, uint8_t range);
bool read(uint8_t channel=0);
inline uint8_t getType(void) {
return msg_type;
};
inline uint8_t getChannel(void) {
}
uint8_t getCable(void) {
return 0;
}
uint8_t getChannel(void) {
return msg_channel;
};
inline uint8_t getData1(void) {
}
uint8_t getData1(void) {
return msg_data1;
};
inline uint8_t getData2(void) {
}
uint8_t getData2(void) {
return msg_data2;
};
inline uint8_t * getSysExArray(void) {
}
uint8_t * getSysExArray(void) {
return msg_sysex;
};
inline void setHandleNoteOff(void (*fptr)(uint8_t channel, uint8_t note, uint8_t velocity)) {
}
void setHandleNoteOff(void (*fptr)(uint8_t channel, uint8_t note, uint8_t velocity)) {
// type: 0x80 NoteOff
handleNoteOff = fptr;
};
inline void setHandleNoteOn(void (*fptr)(uint8_t channel, uint8_t note, uint8_t velocity)) {
}
void setHandleNoteOn(void (*fptr)(uint8_t channel, uint8_t note, uint8_t velocity)) {
// type: 0x90 NoteOn
handleNoteOn = fptr;
};
inline void setHandleVelocityChange(void (*fptr)(uint8_t channel, uint8_t note, uint8_t velocity)) {
}
void setHandleVelocityChange(void (*fptr)(uint8_t channel, uint8_t note, uint8_t velocity)) {
// type: 0xA0 AfterTouchPoly
handleVelocityChange = fptr;
};
inline void setHandleControlChange(void (*fptr)(uint8_t channel, uint8_t control, uint8_t value)) {
}
void setHandleAfterTouchPoly(void (*fptr)(uint8_t channel, uint8_t note, uint8_t pressure)) {
// type: 0xA0 AfterTouchPoly
handleVelocityChange = fptr;
}
void setHandleControlChange(void (*fptr)(uint8_t channel, uint8_t control, uint8_t value)) {
// type: 0xB0 ControlChange
handleControlChange = fptr;
};
inline void setHandleProgramChange(void (*fptr)(uint8_t channel, uint8_t program)) {
}
void setHandleProgramChange(void (*fptr)(uint8_t channel, uint8_t program)) {
// type: 0xC0 ProgramChange
handleProgramChange = fptr;
};
inline void setHandleAfterTouch(void (*fptr)(uint8_t channel, uint8_t pressure)) {
}
void setHandleAfterTouch(void (*fptr)(uint8_t channel, uint8_t pressure)) {
// type: 0xD0 AfterTouchChannel
handleAfterTouch = fptr;
}
void setHandleAfterTouchChannel(void (*fptr)(uint8_t channel, uint8_t pressure)) {
// type: 0xD0 AfterTouchChannel
handleAfterTouch = fptr;
};
inline void setHandlePitchChange(void (*fptr)(uint8_t channel, int pitch)) {
}
void setHandlePitchChange(void (*fptr)(uint8_t channel, int pitch)) {
// type: 0xE0 PitchBend
handlePitchChange = fptr;
};
inline void setHandleRealTimeSystem(void (*fptr)(uint8_t realtimebyte)) {
}
void setHandleSysEx(void (*fptr)(const uint8_t *data, uint16_t length, bool complete)) {
// type: 0xF0 SystemExclusive - multiple calls for message bigger than buffer
handleSysExPartial = (void (*)(const uint8_t *, uint16_t, uint8_t))fptr;
}
void setHandleSystemExclusive(void (*fptr)(const uint8_t *data, uint16_t length, bool complete)) {
// type: 0xF0 SystemExclusive - multiple calls for message bigger than buffer
handleSysExPartial = (void (*)(const uint8_t *, uint16_t, uint8_t))fptr;
}
void setHandleSystemExclusive(void (*fptr)(uint8_t *data, unsigned int size)) {
// type: 0xF0 SystemExclusive - single call, message larger than buffer is truncated
handleSysExComplete = fptr;
}
void setHandleTimeCodeQuarterFrame(void (*fptr)(uint8_t data)) {
// type: 0xF1 TimeCodeQuarterFrame
handleTimeCodeQuarterFrame = fptr;
}
void setHandleSongPosition(void (*fptr)(uint16_t beats)) {
// type: 0xF2 SongPosition
handleSongPosition = fptr;
}
void setHandleSongSelect(void (*fptr)(uint8_t songnumber)) {
// type: 0xF3 SongSelect
handleSongSelect = fptr;
}
void setHandleTuneRequest(void (*fptr)(void)) {
// type: 0xF6 TuneRequest
handleTuneRequest = fptr;
}
void setHandleClock(void (*fptr)(void)) {
// type: 0xF8 Clock
handleClock = fptr;
}
void setHandleStart(void (*fptr)(void)) {
// type: 0xFA Start
handleStart = fptr;
}
void setHandleContinue(void (*fptr)(void)) {
// type: 0xFB Continue
handleContinue = fptr;
}
void setHandleStop(void (*fptr)(void)) {
// type: 0xFC Stop
handleStop = fptr;
}
void setHandleActiveSensing(void (*fptr)(void)) {
// type: 0xFE ActiveSensing
handleActiveSensing = fptr;
}
void setHandleSystemReset(void (*fptr)(void)) {
// type: 0xFF SystemReset
handleSystemReset = fptr;
}
void setHandleRealTimeSystem(void (*fptr)(uint8_t realtimebyte)) {
// type: 0xF8-0xFF - if more specific handler not configured
handleRealTimeSystem = fptr;
};
}
private:
void send_raw(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3);
void sendSysEx_BufferHasTerm(uint16_t length, const uint8_t *data);
void sendSysEx_AddTermBytes(uint16_t length, const uint8_t *data);
void read_sysex_byte(uint8_t b);
uint8_t msg_channel;
uint8_t msg_type;
uint8_t msg_data1;
uint8_t msg_data2;
uint8_t msg_sysex[USB_MIDI_SYSEX_MAX];
uint8_t msg_sysex_len;
uint16_t msg_sysex_len;
void (*handleNoteOff)(uint8_t ch, uint8_t note, uint8_t vel);
void (*handleNoteOn)(uint8_t ch, uint8_t note, uint8_t vel);
void (*handleVelocityChange)(uint8_t ch, uint8_t note, uint8_t vel);
@@ -95,6 +301,18 @@ private:
void (*handleProgramChange)(uint8_t ch, uint8_t);
void (*handleAfterTouch)(uint8_t ch, uint8_t);
void (*handlePitchChange)(uint8_t ch, int pitch);
void (*handleSysExPartial)(const uint8_t *data, uint16_t length, uint8_t complete);
void (*handleSysExComplete)(uint8_t *data, unsigned int size);
void (*handleTimeCodeQuarterFrame)(uint8_t data);
void (*handleSongPosition)(uint16_t beats);
void (*handleSongSelect)(uint8_t songnumber);
void (*handleTuneRequest)(void);
void (*handleClock)(void);
void (*handleStart)(void);
void (*handleContinue)(void);
void (*handleStop)(void);
void (*handleActiveSensing)(void);
void (*handleSystemReset)(void);
void (*handleRealTimeSystem)(uint8_t rtb);
};


Loading…
取消
儲存