| LUFA Library 140302 |

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
Common Class Definitions
MIDI Class Driver

## Data Structures
struct | MIDI_EventPacket_t
| MIDI Class Driver Event Packet. More...
struct | USB_MIDI_Descriptor_AudioInterface_AS_t
| MIDI class-specific Streaming Interface Descriptor (LUFA naming conventions). More...
struct | USB_MIDI_Descriptor_InputJack_t
| MIDI class-specific Input Jack Descriptor (LUFA naming conventions). More...
struct | USB_MIDI_Descriptor_Jack_Endpoint_t
| Audio class-specific Jack Endpoint Descriptor (LUFA naming conventions). More...
struct | USB_MIDI_Descriptor_OutputJack_t
| MIDI class-specific Output Jack Descriptor (LUFA naming conventions). More...
struct | USB_MIDI_StdDescriptor_AudioInterface_AS_t
| MIDI class-specific Streaming Interface Descriptor (USB-IF naming conventions). More...
struct | USB_MIDI_StdDescriptor_InputJack_t
| MIDI class-specific Input Jack Descriptor (USB-IF naming conventions). More...
struct | USB_MIDI_StdDescriptor_Jack_Endpoint_t
| Audio class-specific Jack Endpoint Descriptor (USB-IF naming conventions). More...
struct | USB_MIDI_StdDescriptor_OutputJack_t
| MIDI class-specific Output Jack Descriptor (USB-IF naming conventions). More...

## Macros
#define | MIDI_CHANNEL(channel) ((channel) - 1)
#define | MIDI_EVENT(virtualcable, command) ((virtualcable << 4) | (command >> 4))
#define | MIDI_STANDARD_VELOCITY 64

## Enumerations
enum | MIDI_JackTypes_t { MIDI_JACKTYPE_Embedded = 0x01, MIDI_JACKTYPE_External = 0x02 }

## MIDI Command Values
See http://www.midi.org/techspecs/midimessages.php for more information.
#define | MIDI_COMMAND_SYSEX_1BYTE MIDI_COMMAND_SYSEX_END_1BYTE
#define | MIDI_COMMAND_SYSEX_2BYTE 0x20
#define | MIDI_COMMAND_SYSEX_3BYTE 0x30
#define | MIDI_COMMAND_SYSEX_START_3BYTE 0x40
#define | MIDI_COMMAND_SYSEX_END_1BYTE 0x50
#define | MIDI_COMMAND_SYSEX_END_2BYTE 0x60
#define | MIDI_COMMAND_SYSEX_END_3BYTE 0x70
#define | MIDI_COMMAND_NOTE_OFF 0x80
#define | MIDI_COMMAND_NOTE_ON 0x90
#define | MIDI_COMMAND_NOTE_PRESSURE 0xA0
#define | MIDI_COMMAND_CONTROL_CHANGE 0xB0
#define | MIDI_COMMAND_PROGRAM_CHANGE 0xC0
#define | MIDI_COMMAND_CHANNEL_PRESSURE 0xD0
#define | MIDI_COMMAND_PITCH_WHEEL_CHANGE 0xE0

## Detailed Description

# Module Description

Constants, Types and Enum definitions that are common to both Device and Host modes for the USB MIDI Class.

## Macro Definition Documentation

#define MIDI_CHANNEL | ( |  | channel | ) | ((channel) - 1)

Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.

Parameters

  [in] | channel | MIDI channel number to address.

Returns
  Constructed MIDI channel ID.

#define MIDI_COMMAND_CHANNEL_PRESSURE 0xD0

MIDI command for a channel pressure change event.

#define MIDI_COMMAND_CONTROL_CHANGE 0xB0

MIDI command for a control change event.

#define MIDI_COMMAND_NOTE_OFF 0x80

MIDI command for a note off (deactivation) event.

#define MIDI_COMMAND_NOTE_ON 0x90

MIDI command for a note on (activation) event.

#define MIDI_COMMAND_NOTE_PRESSURE 0xA0

MIDI command for a note pressure change event.

#define MIDI_COMMAND_PITCH_WHEEL_CHANGE 0xE0

MIDI command for a pitch change event.

#define MIDI_COMMAND_PROGRAM_CHANGE 0xC0

MIDI command for a control change event.

#define MIDI_COMMAND_SYSEX_1BYTE MIDI_COMMAND_SYSEX_END_1BYTE

MIDI command for System Exclusive (SysEx) single event that has one byte of data total.

#define MIDI_COMMAND_SYSEX_2BYTE 0x20

MIDI command for System Exclusive (SysEx) single event that has two bytes of data total.

#define MIDI_COMMAND_SYSEX_3BYTE 0x30

MIDI command for System Exclusive (SysEx) single event that has three bytes of data total.

#define MIDI_COMMAND_SYSEX_END_1BYTE 0x50

MIDI command for System Exclusive (SysEx) stream event terminator with one remaining data byte.

#define MIDI_COMMAND_SYSEX_END_2BYTE 0x60

MIDI command for System Exclusive (SysEx) stream event terminator with two remaining data bytes.

#define MIDI_COMMAND_SYSEX_END_3BYTE 0x70

MIDI command for System Exclusive (SysEx) stream event terminator with three remaining data bytes.

#define MIDI_COMMAND_SYSEX_START_3BYTE 0x40

MIDI command for System Exclusive (SysEx) stream event that has at least four bytes of data total.

#define MIDI_EVENT | ( |  | virtualcable,
|  |  | command
| ) |  | ((virtualcable << 4) | (command >> 4))

Constructs a MIDI event ID from a given MIDI command and a virtual MIDI cable index. This can then be used to create and decode MIDI_EventPacket_t MIDI event packets.

Parameters

  [in] | virtualcable | Index of the virtual MIDI cable the event relates to
  [in] | command | MIDI command to send through the virtual MIDI cable

Returns
  Constructed MIDI event ID.

#define MIDI_STANDARD_VELOCITY 64

Standard key press velocity value used for all note events.

## Enumeration Type Documentation

enum MIDI_JackTypes_t

Enum for the possible MIDI jack types in a MIDI device jack descriptor.

Enumerator
MIDI_JACKTYPE_Embedded | MIDI class descriptor jack type value for an embedded (logical) MIDI input or output jack.
MIDI_JACKTYPE_External | MIDI class descriptor jack type value for an external (physical) MIDI input or output jack.