| 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															        void end(void) { } | 
															 | 
															 | 
															        void end(void) { } | 
														
														
													
														
															 | 
															 | 
															        void sendNoteOff(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendNoteOff(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0x80, note, velocity, channel, cable); | 
															 | 
															 | 
																	send(0x80, note, velocity, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void sendNoteOn(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendNoteOn(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0x90, note, velocity, channel, cable); | 
															 | 
															 | 
																	send(0x90, note, velocity, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void sendPolyPressure(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendPolyPressure(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0xA0, note, pressure, channel, cable); | 
															 | 
															 | 
																	send(0xA0, note, pressure, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void sendAfterTouch(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void sendAfterTouch(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0xA0, note, pressure, channel, cable); | 
															 | 
															 | 
																	send(0xA0, note, pressure, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void sendControlChange(uint8_t control, uint8_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendControlChange(uint8_t control, uint8_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0xB0, control, value, channel, cable); | 
															 | 
															 | 
																	send(0xB0, control, value, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void sendProgramChange(uint8_t program, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendProgramChange(uint8_t program, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0xC0, program, 0, channel, cable); | 
															 | 
															 | 
																	send(0xC0, program, 0, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void sendAfterTouch(uint8_t pressure, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendAfterTouch(uint8_t pressure, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0xD0, pressure, 0, channel, cable); | 
															 | 
															 | 
																	send(0xD0, pressure, 0, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void sendPitchBend(uint16_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendPitchBend(uint16_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	// MIDI 4.3 takes -8192 to +8191.  We take 0 to 16383 | 
															 | 
															 | 
																	// MIDI 4.3 takes -8192 to +8191.  We take 0 to 16383 | 
														
														
													
														
															 | 
															 | 
																	// MIDI 4.3 also has version that takes float -1.0 to +1.0 | 
															 | 
															 | 
																	// MIDI 4.3 also has version that takes float -1.0 to +1.0 | 
														
														
													
														
															 | 
															 | 
																	send(0xE0, value, value >> 7, channel, cable); | 
															 | 
															 | 
																	send(0xE0, value, value >> 7, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void sendSysEx(uint32_t length, const uint8_t *data, bool hasTerm=false, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void sendSysEx(uint32_t length, const uint8_t *data, bool hasTerm=false, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	if (cable >= MIDI_NUM_CABLES) return; | 
															 | 
															 | 
																	if (cable >= MIDI_NUM_CABLES) return; | 
														
														
													
														
															 | 
															 | 
																	if (hasTerm) { | 
															 | 
															 | 
																	if (hasTerm) { | 
														
														
													
												
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
																	} else { | 
															 | 
															 | 
																	} else { | 
														
														
													
														
															 | 
															 | 
																		usb_midi_send_sysex(data, length, cable); | 
															 | 
															 | 
																		usb_midi_send_sysex(data, length, cable); | 
														
														
													
														
															 | 
															 | 
																	} | 
															 | 
															 | 
																	} | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void sendRealTime(uint8_t type, uint8_t cable=0) __attribute__((always_inline)) __attribute__((always_inline)) { | 
															 | 
															 | 
																void sendRealTime(uint8_t type, uint8_t cable=0) __attribute__((always_inline)) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	switch (type) { | 
															 | 
															 | 
																	switch (type) { | 
														
														
													
														
															 | 
															 | 
																		case 0xF8: // Clock | 
															 | 
															 | 
																		case 0xF8: // Clock | 
														
														
													
												
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
																		default: // Invalid Real Time marker | 
															 | 
															 | 
																		default: // Invalid Real Time marker | 
														
														
													
														
															 | 
															 | 
																			break; | 
															 | 
															 | 
																			break; | 
														
														
													
														
															 | 
															 | 
																	} | 
															 | 
															 | 
																	} | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																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)) { | 
															 | 
															 | 
															        //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 | 
															 | 
															 | 
																	// MIDI 4.3 has this, but we can't implement with cable param | 
														
														
													
														
															 | 
															 | 
																	//send(0xF1, data, 0, 0, cable); | 
															 | 
															 | 
																	//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); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void sendSongSelect(uint8_t song, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void sendSongSelect(uint8_t song, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0xF3, song, 0, 0, cable); | 
															 | 
															 | 
																	send(0xF3, song, 0, 0, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void sendTuneRequest(uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void sendTuneRequest(uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	send(0xF6, 0, 0, 0, cable); | 
															 | 
															 | 
																	send(0xF6, 0, 0, 0, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void beginRpn(uint16_t number, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void beginRpn(uint16_t number, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(101, number >> 7, channel, cable); | 
															 | 
															 | 
																	sendControlChange(101, number >> 7, channel, cable); | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(100, number, channel, cable); | 
															 | 
															 | 
																	sendControlChange(100, number, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void sendRpnValue(uint16_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void sendRpnValue(uint16_t value, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	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)) { | 
															 | 
															 | 
																void sendRpnValue(uint8_t msb, uint8_t lsb, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(6, msb, channel, cable); | 
															 | 
															 | 
																	sendControlChange(6, msb, channel, cable); | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(38, lsb, 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); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void sendRpnDecrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void sendRpnDecrement(uint8_t amount, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(97, amount, channel, cable); | 
															 | 
															 | 
																	sendControlChange(97, amount, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void endRpn(uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void endRpn(uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(101, 0x7F, channel, cable); | 
															 | 
															 | 
																	sendControlChange(101, 0x7F, channel, cable); | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(100, 0x7F, channel, cable); | 
															 | 
															 | 
																	sendControlChange(100, 0x7F, channel, cable); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
																void beginNrpn(uint16_t number, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
															 | 
															 | 
																void beginNrpn(uint16_t number, uint8_t channel, uint8_t cable=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(99, number >> 7, channel, cable); | 
															 | 
															 | 
																	sendControlChange(99, number >> 7, channel, cable); | 
														
														
													
														
															 | 
															 | 
																	sendControlChange(98, number, channel, cable); | 
															 | 
															 | 
																	sendControlChange(98, number, channel, cable); | 
														
														
													
												
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
																		  | (((channel - 1) & 0x0F) << 8) | ((data1 & 0x7F) << 16) | 
															 | 
															 | 
																		  | (((channel - 1) & 0x0F) << 8) | ((data1 & 0x7F) << 16) | 
														
														
													
														
															 | 
															 | 
																		  | ((data2 & 0x7F) << 24)); | 
															 | 
															 | 
																		  | ((data2 & 0x7F) << 24)); | 
														
														
													
														
															 | 
															 | 
																	} else if (type >= 0xF8 || type == 0xF6) { | 
															 | 
															 | 
																	} else if (type >= 0xF8 || type == 0xF6) { | 
														
														
													
														
															 | 
															 | 
																		usb_midi_write_packed((type << 8) | 0x0F | ((cable & 0x0F) << 4) | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
																		  | ((data1 & 0x7F) << 16) | ((data2 & 0x7F) << 24)); | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																		usb_midi_write_packed((type << 8) | 0x0F | ((cable & 0x0F) << 4)); | 
														
														
													
														
															 | 
															 | 
																	} else if (type == 0xF1 || type == 0xF3) { | 
															 | 
															 | 
																	} else if (type == 0xF1 || type == 0xF3) { | 
														
														
													
														
															 | 
															 | 
																		usb_midi_write_packed((type << 8) | 0x02 | ((cable & 0x0F) << 4) | 
															 | 
															 | 
																		usb_midi_write_packed((type << 8) | 0x02 | ((cable & 0x0F) << 4) | 
														
														
													
														
															 | 
															 | 
																		  | ((data1 & 0x7F) << 16)); | 
															 | 
															 | 
																		  | ((data1 & 0x7F) << 16)); | 
														
														
													
												
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
																		usb_midi_write_packed((type << 8) | 0x03 | ((cable & 0x0F) << 4) | 
															 | 
															 | 
																		usb_midi_write_packed((type << 8) | 0x03 | ((cable & 0x0F) << 4) | 
														
														
													
														
															 | 
															 | 
																		  | ((data1 & 0x7F) << 16) | ((data2 & 0x7F) << 24)); | 
															 | 
															 | 
																		  | ((data1 & 0x7F) << 16) | ((data2 & 0x7F) << 24)); | 
														
														
													
														
															 | 
															 | 
																	} | 
															 | 
															 | 
																	} | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        void send_now(void) __attribute__((always_inline)) { | 
															 | 
															 | 
															        void send_now(void) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	usb_midi_flush_output(); | 
															 | 
															 | 
																	usb_midi_flush_output(); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        uint8_t analog2velocity(uint16_t val, uint8_t range); | 
															 | 
															 | 
															        uint8_t analog2velocity(uint16_t val, uint8_t range); | 
														
														
													
														
															 | 
															 | 
															        bool read(uint8_t channel=0) __attribute__((always_inline)) { | 
															 | 
															 | 
															        bool read(uint8_t channel=0) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
																	return usb_midi_read(channel); | 
															 | 
															 | 
																	return usb_midi_read(channel); | 
														
														
													
														
															 | 
															 | 
																}; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
																} | 
														
														
													
														
															 | 
															 | 
															        uint8_t getType(void) __attribute__((always_inline)) { | 
															 | 
															 | 
															        uint8_t getType(void) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
															                return usb_midi_msg_type; | 
															 | 
															 | 
															                return usb_midi_msg_type; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        uint8_t getCable(void) __attribute__((always_inline)) { | 
															 | 
															 | 
															        uint8_t getCable(void) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
															                return usb_midi_msg_cable; | 
															 | 
															 | 
															                return usb_midi_msg_cable; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        uint8_t getChannel(void) __attribute__((always_inline)) { | 
															 | 
															 | 
															        uint8_t getChannel(void) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
															                return usb_midi_msg_channel; | 
															 | 
															 | 
															                return usb_midi_msg_channel; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        uint8_t getData1(void) __attribute__((always_inline)) { | 
															 | 
															 | 
															        uint8_t getData1(void) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
															                return usb_midi_msg_data1; | 
															 | 
															 | 
															                return usb_midi_msg_data1; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        uint8_t getData2(void) __attribute__((always_inline)) { | 
															 | 
															 | 
															        uint8_t getData2(void) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
															                return usb_midi_msg_data2; | 
															 | 
															 | 
															                return usb_midi_msg_data2; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        uint8_t * getSysExArray(void) __attribute__((always_inline)) { | 
															 | 
															 | 
															        uint8_t * getSysExArray(void) __attribute__((always_inline)) { | 
														
														
													
														
															 | 
															 | 
															                return usb_midi_msg_sysex; | 
															 | 
															 | 
															                return usb_midi_msg_sysex; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        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 | 
															 | 
															 | 
																	// type: 0x80  NoteOff | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleNoteOff = fptr; | 
															 | 
															 | 
															                usb_midi_handleNoteOff = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        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 | 
															 | 
															 | 
																	// type: 0x90  NoteOn | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleNoteOn = fptr; | 
															 | 
															 | 
															                usb_midi_handleNoteOn = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        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 | 
															 | 
															 | 
																	// type: 0xA0  AfterTouchPoly | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleVelocityChange = fptr; | 
															 | 
															 | 
															                usb_midi_handleVelocityChange = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
																void setHandleAfterTouchPoly(void (*fptr)(uint8_t channel, uint8_t note, uint8_t pressure)) { | 
															 | 
															 | 
																void setHandleAfterTouchPoly(void (*fptr)(uint8_t channel, uint8_t note, uint8_t pressure)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xA0  AfterTouchPoly | 
															 | 
															 | 
																	// type: 0xA0  AfterTouchPoly | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleVelocityChange = fptr; | 
															 | 
															 | 
															                usb_midi_handleVelocityChange = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        void setHandleControlChange(void (*fptr)(uint8_t channel, uint8_t control, uint8_t value)) { | 
															 | 
															 | 
															        void setHandleControlChange(void (*fptr)(uint8_t channel, uint8_t control, uint8_t value)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xB0  ControlChange | 
															 | 
															 | 
																	// type: 0xB0  ControlChange | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleControlChange = fptr; | 
															 | 
															 | 
															                usb_midi_handleControlChange = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        void setHandleProgramChange(void (*fptr)(uint8_t channel, uint8_t program)) { | 
															 | 
															 | 
															        void setHandleProgramChange(void (*fptr)(uint8_t channel, uint8_t program)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xC0  ProgramChange | 
															 | 
															 | 
																	// type: 0xC0  ProgramChange | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleProgramChange = fptr; | 
															 | 
															 | 
															                usb_midi_handleProgramChange = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        void setHandleAfterTouch(void (*fptr)(uint8_t channel, uint8_t pressure)) { | 
															 | 
															 | 
															        void setHandleAfterTouch(void (*fptr)(uint8_t channel, uint8_t pressure)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xD0  AfterTouchChannel | 
															 | 
															 | 
																	// type: 0xD0  AfterTouchChannel | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleAfterTouch = fptr; | 
															 | 
															 | 
															                usb_midi_handleAfterTouch = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        void setHandleAfterTouchChannel(void (*fptr)(uint8_t channel, uint8_t pressure)) { | 
															 | 
															 | 
															        void setHandleAfterTouchChannel(void (*fptr)(uint8_t channel, uint8_t pressure)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xD0  AfterTouchChannel | 
															 | 
															 | 
																	// type: 0xD0  AfterTouchChannel | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleAfterTouch = fptr; | 
															 | 
															 | 
															                usb_midi_handleAfterTouch = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        void setHandlePitchChange(void (*fptr)(uint8_t channel, int pitch)) { | 
															 | 
															 | 
															        void setHandlePitchChange(void (*fptr)(uint8_t channel, int pitch)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xE0  PitchBend | 
															 | 
															 | 
																	// type: 0xE0  PitchBend | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handlePitchChange = fptr; | 
															 | 
															 | 
															                usb_midi_handlePitchChange = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
															        void setHandleSysEx(void (*fptr)(const uint8_t *data, uint16_t length, bool complete)) { | 
															 | 
															 | 
															        void setHandleSysEx(void (*fptr)(const uint8_t *data, uint16_t length, bool complete)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xF0  SystemExclusive - multiple calls for message bigger than buffer | 
															 | 
															 | 
																	// type: 0xF0  SystemExclusive - multiple calls for message bigger than buffer | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleSysExPartial = (void (*)(const uint8_t *, uint16_t, uint8_t))fptr; | 
															 | 
															 | 
															                usb_midi_handleSysExPartial = (void (*)(const uint8_t *, uint16_t, uint8_t))fptr; | 
														
														
													
												
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															        void setHandleTimeCodeQuarterFrame(void (*fptr)(uint8_t data)) { | 
															 | 
															 | 
															        void setHandleTimeCodeQuarterFrame(void (*fptr)(uint8_t data)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xF1  TimeCodeQuarterFrame | 
															 | 
															 | 
																	// type: 0xF1  TimeCodeQuarterFrame | 
														
														
													
														
															 | 
															 | 
															                usb_midi_handleTimeCodeQuarterFrame = fptr; | 
															 | 
															 | 
															                usb_midi_handleTimeCodeQuarterFrame = fptr; | 
														
														
													
														
															 | 
															 | 
															        }; | 
															 | 
															 | 
															 | 
														
														
													
														
															 | 
															 | 
															 | 
															 | 
															 | 
															        } | 
														
														
													
														
															 | 
															 | 
																void setHandleSongPosition(void (*fptr)(uint16_t beats)) { | 
															 | 
															 | 
																void setHandleSongPosition(void (*fptr)(uint16_t beats)) { | 
														
														
													
														
															 | 
															 | 
																	// type: 0xF2  SongPosition | 
															 | 
															 | 
																	// type: 0xF2  SongPosition | 
														
														
													
														
															 | 
															 | 
																	usb_midi_handleSongPosition = fptr; | 
															 | 
															 | 
																	usb_midi_handleSongPosition = fptr; |