<CoreServices/CoreServices.h>,
<CoreFoundation/CoreFoundation.h>,
<stddef.h>
This is the header file for Mac OS X's MIDI system services.
Drivers own and control Devices, e.g. USB interfaces, PCI cards, etc. A device is defined
as a physical object that would be represented by a single icon if there were a graphical
view of the studio.
Devices may have multiple logically distinct sub-components, e.g. a MIDI synthesizer and a
pair of MIDI ports, both addressable via a USB port. These are called Entities.
Entities have any number of Endpoints, sources and destinations of 16-channel MIDI streams.
By grouping a device's endpoints into entities, the system has enough information for an
application to make reasonable default assumptions about how to communicate in a
bi-directional manner with each entity, as is necessary in MIDI librarian applications.
CoreMIDI attaches a collection of properties to each object it manages. Some properties are
dynamic characteristics of a device (e.g. MIDI receive channel and system-exclusive ID's),
and some are a matter of user preference (choice of icon, whether the device should appear
in lists of possible controllers). Other properties are static and could be looked up in a
database, using the device's manufacturer and model names as a key.
The client API is implemented as the CoreMIDI framework, which uses IPC to communicate with
a server process, MIDIServer.
The server process loads, and manages all communication with, MIDI drivers. Most of its
implementation is in the CoreMIDIServer framework, which drivers may import in order to
access the API.
"Drivers" are not I/O Kit drivers. They are bundles containing CFPlugins.
Many MIDI drivers can simply be user-side I/O Kit clients (probably for serial, USB,
Firewire).
PCI card drivers will need their MIDI drivers to communicate with a separate kernel
extension.
When passing a CF object to a MIDI function, the MIDI function will never consume a
reference to the object; the caller always retains a reference which it is responsible for
releasing with CFRelease().
When receiving a CF object as a return value from a MIDI function, the caller always
receives a new reference to the object, and is responsible for releasing it.