Architecture Topics

The following are some related pages.

MIDI 2.0

In order to support MIDI 2.0, there had to be a number of changes to the CoreMIDI library. In the table below, Original Architecture refers to the architecture before blocks were introduced, such as the functions making use of MIDINotifyProc and MIDIReadProc, Old Architecture refers to the software items associated with MIDI 1.0, and New Architecture refers to the functions that can support both MIDI 1.0 and MIDI 2.0 systems. The term Universal MIDI Packet (UMP) refers to a method for encoding data for use both MIDI 1.0 and MIDI 2.0, with the software making the appropriate transformations to the information sent to and received from the MIDI devices.

FunctionOriginal ArchitectureOld ArchitectureNew Architecture
Create a client MIDIClientCreate MIDIClientCreateWithBlock MIDIClientCreateWithBlock [Apple Doc]
Call-back for client MIDINotifyProc MIDINotifyBlock MIDINotifyBlock
Creates a virtual destination to a client. MIDIDestinationCreate MIDIDestinationCreateWithBlock MIDIDestinationCreateWithProtocol [Apple Doc]
Creates a virtual source for a client. MIDISourceCreate MIDISourceCreate MIDISourceCreateWithProtocol [Apple Doc]
Creates an input port for a client through which the client can receive incoming MIDI messages from any MIDI source. MIDIInputPortCreate MIDIInputPortCreateWithBlock MIDIInputPortCreateWithProtocol [Apple Doc]
Creates an output port through which a client sends outgoing MIDI messages to any MIDI destination. MIDIOutputPortCreate MIDIOutputPortCreate MIDIOutputPortCreate [Apple Doc]
Send a MIDIPacketList (legacy) or MIDIEventList (UMP) to a destination. MIDISend MIDISend MIDISendEventList
A set of packets. MIDIPacketList MIDIPacketList MIDIEventList
Initialize the packet list structure. MIDIPacketListInit MIDIPacketListInit MIDIEventListInit
Add a MIDI packet or event packet to the packet list or event packet list. MIDIPacketListAdd MIDIPacketListAdd MIDIEventListAdd
A group of MIDI commands with the same time stamp. MIDIPacket MIDIPacket MIDIEventPacket
Move the pointer to the packet or event packet to the next one in the list. MIDIPacketNext MIDIPacketNext MIDIEventPacketNext
Structure presenting incoming MIDI information. MIDIReadProc MIDIReadBlock MIDIReceiveBlock

The items MIDIClientCreate, MIDINotifyProc, MIDIDestinationCreate, MIDIInputPortCreate, and MIDIReadProc should not be used because of potential interference between threads.

Devices with USB Drivers

When a piece of hardware is connected via a USB (Universal Serial Bus) cable to a computer, it initiates a process known as "handshaking". In this process the device shares information with the computer and the computer connects the device using the most appropriate driver the operating system looks for an associated piece of software known as a driver. Some types of devices such as mice, keyboards, ethernet connections, and telephone connections, there are default drivers that are part of the operating system and will be used unless a more appropriate driver is found. These drivers are usually supplied by the vendor on their website and will provide additional capability for the vendor's products. As part of the handshake, the device sends some information about itself. The result is that the CoreMIDI software always knows how to exchange information with the MIDI devices.

External Devices

If the MIDI device is conneced with 5 pin MIDI cables, the CoreMIDI software can't identify the attached equipment. Hoeever, you can use CoreMIDI to set up external devices using MIDIExternalDevcesCreate, MIDISetupAddExternalDevice, and MIDISetupRemoveExternalDevice.

Virtual Ports and Endpoints

The software components that send and receive MIDI information with other devices are known as MIDI clients.

Non-Musical MIDI Commands

There are a number of MIDI commands where the status byte is in the range 0xF0 to 0xFF. These are known as non musical commands.

0xF0 MIDI System Exclusive message (start)This status byte indicates the first byte of the system exclusive message and there can be any number of data bytes. A data byte containing the value 0xF7 indicates the last byte for the message. (system common)
0xF1MIDI Quarter Frame message There is one data byte. (system common)
0xF2 MIDI Song Position Pointer message There are two data bits that are combined to form a 14 bit integer. (system common)
0xF3MIDI Song Request message There is one data byte (range 0x00 to 0x7F) that contains the number of the song to be played. (system common)
0xF4???
0xF5???
0xF6MIDI Tune Request message There are no data bytes for this messaage. (system common)
0xF7SysEX Continuation If this is the first status byte in a packet, it is SysEx Continuation, meaning that the following bytes are a continuation of the SysEX message from the previous packet. If it is the last byte in a packet, it indicates the end of the SysEx message.
0xF8MIDI Clock message There are no data bytes. (system realtime)
0xF9??????
0xFA MIDI Start message There are no data bytes. (system realtime)
0xFBMIDI Continue message There are no data bytes (system realtime)
0xFCMIDI Stop message There are no data bytes. (system realtime)
0xFD???
0xFEMIDI Active Sense message There are no data bytes. The purpose of this message is to demonstrate to the receiver that the transmitting device is still alive. (system realtime)
0xFFMIDI Reset Message There are no data bytes. (system realtime)