-\r
-/** Sends a MIDI note change event (note on or off) to the MIDI output jack, on the given virtual cable ID and channel.\r
- *\r
- * \param Pitch Pitch of the note to turn on or off\r
- * \param OnOff Set to true if the note is on (being held down), or false otherwise\r
- * \param CableID ID of the virtual cable to send the note change to\r
- * \param Channel MIDI channel number to send the note change event to\r
- */\r
-void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel)\r
-{\r
- /* If endpoint ready for more data, abort */\r
- if (!(Endpoint_IsReadWriteAllowed()))\r
- return;\r
-\r
- /* Check if the message should be a Note On or Note Off command */\r
- uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);\r
-\r
- /* Write the Packet Header to the endpoint */\r
- Endpoint_Write_Byte((CableID << 4) | (Command >> 4));\r
-\r
- /* Write the Note On/Off command with the specified channel, pitch and velocity */\r
- Endpoint_Write_Byte(Command | Channel);\r
- Endpoint_Write_Byte(Pitch);\r
- Endpoint_Write_Byte(MIDI_STANDARD_VELOCITY);\r
- \r
- /* Send the data in the endpoint to the host */\r
- Endpoint_ClearIN();\r
-}\r