usbMIDI KEYWORD1 | usbMIDI KEYWORD1 | ||||
sendNoteOff KEYWORD2 | sendNoteOff KEYWORD2 | ||||
sendNoteOn KEYWORD2 | sendNoteOn KEYWORD2 | ||||
sendAfterTouchPoly KEYWORD2 | |||||
sendPolyPressure KEYWORD2 | sendPolyPressure KEYWORD2 | ||||
sendControlChange KEYWORD2 | sendControlChange KEYWORD2 | ||||
sendProgramChange KEYWORD2 | sendProgramChange KEYWORD2 |
void sendTimeCodeQuarterFrame(uint8_t type, uint8_t value, uint8_t cable=0) __attribute__((always_inline)) __attribute__((always_inline)) { | 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); | send(0xF1, ((type & 0x07) << 4) | (value & 0x0F), 0, 0, cable); | ||||
} | } | ||||
//void sendTimeCodeQuarterFrame(uint8_t data, uint8_t cable=0) __attribute__((always_inline)) { | |||||
// MIDI 4.3 has this, but we can't implement with cable param | |||||
//send(0xF1, data, 0, 0, cable); | |||||
//} | |||||
void sendSongPosition(uint16_t beats, uint8_t cable=0) __attribute__((always_inline)) { | void sendSongPosition(uint16_t beats, uint8_t cable=0) __attribute__((always_inline)) { | ||||
send(0xF2, beats, beats >> 7, 0, cable); | send(0xF2, beats, beats >> 7, 0, cable); | ||||
} | } | ||||
sendControlChange(6, value >> 7, channel, cable); | sendControlChange(6, value >> 7, channel, cable); | ||||
sendControlChange(38, value, 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)) { | void sendRpnIncrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | ||||
sendControlChange(96, amount, channel, cable); | sendControlChange(96, amount, channel, cable); | ||||
} | } | ||||
sendControlChange(6, value >> 7, channel, cable); | sendControlChange(6, value >> 7, channel, cable); | ||||
sendControlChange(38, value, 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)) { | void sendNrpnIncrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | ||||
sendControlChange(96, amount, channel, cable); | sendControlChange(96, amount, channel, cable); | ||||
} | } |
#define USB_MIDI_SYSEX_MAX 60 // maximum sysex length we can receive | #define USB_MIDI_SYSEX_MAX 60 // maximum sysex length we can receive | ||||
/* | |||||
These were originally meant to allow programs written for | |||||
Francois Best's MIDI library to be easily used with | |||||
Teensy's usbMIDI which implements the same API. However, | |||||
the MIDI library definitions have changed, so these names | |||||
now conflict. They've never been documented (the PJRC web | |||||
page documents usbMIDI.getType() in numbers) so they are | |||||
now commented out so usbMIDI and the MIDI library can be | |||||
used together without conflict. | |||||
#define NoteOff 0 | |||||
#define NoteOn 1 | |||||
#define AfterTouchPoly 2 | |||||
#define ControlChange 3 | |||||
#define ProgramChange 4 | |||||
#define AfterTouchChannel 5 | |||||
#define PitchBend 6 | |||||
#define SystemExclusive 7 | |||||
*/ | |||||
class usb_midi_class | class usb_midi_class | ||||
{ | { | ||||
public: | public: | ||||
sendControlChange(6, value >> 7, channel, cable); | sendControlChange(6, value >> 7, channel, cable); | ||||
sendControlChange(38, value, 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)) { | void sendRpnIncrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | ||||
sendControlChange(96, amount, channel, cable); | sendControlChange(96, amount, channel, cable); | ||||
} | } | ||||
sendControlChange(6, value >> 7, channel, cable); | sendControlChange(6, value >> 7, channel, cable); | ||||
sendControlChange(38, value, 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)) { | void sendNrpnIncrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | ||||
sendControlChange(96, amount, channel, cable); | sendControlChange(96, amount, channel, cable); | ||||
} | } |