Structs



MIDIPacket


A collection of simultaneous MIDI events.

struct MIDIPacket { 
    MIDITimeStamp timeStamp; 
    UInt16 length; 
    Byte data[256]; 
}; 
Field Descriptions
timeStamp
The time at which the events occurred, if receiving MIDI, or, if sending MIDI, the time at which the events are to be played. Zero means "now." The time stamp applies to the first MIDI byte in the packet.
length
The number of valid MIDI bytes which follow, in data. (It may be larger than 256 bytes if the packet is dynamically allocated.)
data
A variable-length stream of MIDI messages. Running status is not allowed. In the case of system-exclusive messages, a packet may only contain a single message, or portion of one, with no other MIDI events.

The MIDI messages in the packet must always be complete, except for system-exclusive.

(This is declared to be 256 bytes in length so clients don't have to create custom data structures in simple situations.)

MIDIPacketList


A list of MIDI events being received from, or being sent to, one endpoint.

struct MIDIPacketList { 
    UInt32 numPackets; 
    MIDIPacket packet[1]; 
}; 
Field Descriptions
numPackets
The number of MIDIPackets in the list.
packet
An open-ended array of variable-length MIDIPackets.
Discussion

The timestamps in the packet list must be in ascending order.

Note that the packets in the list, while defined as an array, may not be accessed as an array, since they are variable-length. To iterate through the packets in a packet list, use a loop such as:

MIDIPacket *packet = &packetList->packet[0];
  for (int i = 0; i < packetList->numPackets; ++i) {
    ...
    packet = MIDIPacketNext(packet);
  }



MIDISysexSendRequest


A request to transmit a system-exclusive event.

struct MIDISysexSendRequest { 
    MIDIEndpointRef destination; 
    const Byte *data; 
    UInt32 bytesToSend; 
    Boolean complete; 
    Byte reserved[3]; 
    MIDICompletionProc completionProc; 
    void *completionRefCon; 
}; 
Field Descriptions
destination
The endpoint to which the event is to be sent.
data
Initially, a pointer to the sys-ex event to be sent. MIDISendSysex will advance this pointer as bytes are sent.
bytesToSend
Initially, the number of bytes to be sent. MIDISendSysex will decrement this counter as bytes are sent.
complete
The client may set this to true at any time to abort transmission. The implementation sets this to true when all bytes have been sent.
completionProc
Called when all bytes have been sent, or after the client has set complete to true.
completionRefCon
Passed as a refCon to completionProc.

Discussion

This represents a request to send a single system-exclusive MIDI event to a MIDI destination asynchronously.


MIDINotification


A message describing a system state change.

struct MIDINotification { 
    MIDINotificationMessageID messageID; 
    ByteCount messageSize; 
    // additional data may follow, depending on messageID 
}; 
Field Descriptions
messageID
type of message
messageSize
size of the entire message, including messageID and messageSize
Discussion

A MIDINotification is a structure passed to a MIDINotifyProc, when CoreMIDI wishes to inform a client of a change in the state of the system.


MIDIObjectAddRemoveNotification


A message describing the addition or removal of an object.

struct MIDIObjectAddRemoveNotification { 
    MIDINotificationMessageID messageID; 
    ByteCount messageSize; 
    MIDIObjectRef parent; 
    MIDIObjectType parentType; 
    MIDIObjectRef child; 
    MIDIObjectType childType; 
}; 
Field Descriptions
messageID
type of message
messageSize
size of the entire message, including messageID and messageSize
parent
the parent of the added or removed object (possibly NULL)
parentType
the type of the parent object (undefined if parent is NULL)
child
the added or removed object
childType
the type of the added or removed object

MIDIObjectPropertyChangeNotification


A message describing the addition or removal of an object.

struct MIDIObjectPropertyChangeNotification { 
    MIDINotificationMessageID messageID; 
    ByteCount messageSize; 
    MIDIObjectRef object; 
    MIDIObjectType objectType; 
    CFStringRef propertyName; 
}; 
Field Descriptions
messageID
type of message
messageSize
size of the entire message, including messageID and messageSize
object
the object whose property has changed
objectType
the type of the object whose property has changed
propertyName
the name of the changed property

(Last Updated February 25, 2005)