Defined Types



MIDIObjectRef


The base class of many CoreMIDI objects.

typedef void * MIDIObjectRef; 
Discussion

MIDIObject is the base class for many of the objects in CoreMIDI. They have properties, and often an "owner" object, from which they inherit any properties they do not themselves have.

Developers may add their own private properties, whose names must begin with their company's inverted domain name, as in Java package names, but with underscores instead of dots, e.g.: com_apple_APrivateAppleProperty


MIDIClientRef


An object maintaining per-client state.

typedef struct OpaqueMIDIClient * MIDIClientRef; 
Discussion

Derives from MIDIObjectRef, does not have an owner object.

To use CoreMIDI, an application creates a MIDIClientRef, to which it can add MIDIPortRef's, through which it can send and receive MIDI.


MIDIPortRef


A MIDI connection port owned by a client.

typedef struct OpaqueMIDIPort * MIDIPortRef; 
Discussion

Derives from MIDIObjectRef, owned by a MIDIClientRef.

A MIDIPortRef, which may be an input port or output port, is an object through which a client may communicate with any number of MIDI sources or destinations.


MIDIDeviceRef


A MIDI device or external device, containing entities.

typedef struct OpaqueMIDIDevice * MIDIDeviceRef; 
Discussion

Derives from MIDIObjectRef, does not have an owner object.

A MIDI device, which either attaches directly to the computer and is controlled by a MIDI driver, or which is "external," meaning that it is connected to a driver-controlled device via a standard MIDI cable.

A MIDIDeviceRef has properties and contains MIDIEntityRef's.


MIDIEntityRef


A MIDI entity, owned by a device, containing endpoints.

typedef struct OpaqueMIDIEntity * MIDIEntityRef; 
Discussion

Derives from MIDIObjectRef, owned by a MIDIDeviceRef.

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.

By grouping a device's endpoints into entities, the system has enough information for an application to make reasonable assumptions about how to communicate in a bi-directional manner with each entity, as is desirable in MIDI librarian applications.

These sub-components are MIDIEntityRef's.


MIDIEndpointRef


A MIDI source or destination, owned by an entity.

typedef struct OpaqueMIDIEndpoint * MIDIEndpointRef; 
Discussion

Derives from MIDIObjectRef, owned by a MIDIEntityRef, unless it is a virtual endpoint, in which case there is no owning entity.

Entities have any number of MIDIEndpointRef's, sources and destinations of 16-channel MIDI streams.


MIDITimeStamp


A host clock time.

typedef UInt64 MIDITimeStamp; 
Discussion

A host clock time representing the time of an event, as returned by mach_absolute_time() or UpTime().

Since MIDI applications will tend to do a fair amount of math with the times of events, it's more convenient to use a UInt64 than an AbsoluteTime.

See CoreAudio/HostTime.h.


MIDIUniqueID


A unique identifier for a MIDIObjectRef.

typedef SInt32 MIDIUniqueID; 
Discussion

An integer which uniquely identifies a MIDIObjectRef.


MIDINotifyProc


A callback function for notifying clients of state changes.

typedef void (*MIDINotifyProc)(
    const MIDINotification *message,
    void *refCon); 
Parameter Descriptions
message
A structure containing information about what changed.
refCon
The client's refCon passed to MIDIClientCreate.
Discussion

This callback function is called when some aspect of the current MIDI setup changes. It is called on the runloop (thread) on which MIDIClientCreate was first called.


MIDIReadProc


A function receiving MIDI input.

typedef void (*MIDIReadProc)(
    const MIDIPacketList *pktlist,
    void *readProcRefCon,
    void *srcConnRefCon); 
Parameter Descriptions
pktlist
The incoming MIDI message(s).
readProcRefCon
The refCon you passed to MIDIInputPortCreate or MIDIDestinationCreate
srcConnRefCon
A refCon you passed to MIDIPortConnectSource, which identifies the source of the data.
Discussion

This is a callback function through which a client receives incoming MIDI messages.

A MIDIReadProc function pointer is passed to the MIDIInputPortCreate and MIDIDestinationCreate functions. The CoreMIDI framework will create a high-priority receive thread on your client's behalf, and from that thread, your MIDIReadProc will be called when incoming MIDI messages arrive. Because this function is called from a separate thread, be aware of the synchronization issues when accessing data in this callback.


MIDICompletionProc


A function called when a system-exclusive event has been completely sent.

typedef void (*MIDICompletionProc)(
    MIDISysexSendRequest *request); 
Parameter Descriptions
request
The MIDISysexSendRequest which has completed, or been aborted.
Discussion

Callback function to notify the client of the completion of a call to MIDISendSysex.

(Last Updated February 25, 2005)