CoreMidi Namespace

Access to the MIDI subsystem.

Remarks

CoreMIDI is an API that talks to the MIDI server on iOS and OSX which in turn interacts with MIDI devices connected to your Mac or iOS device.

When using CoreMIDI, you will run into various classes that deal with different parts of the MIDI stack, the following graphic illustrates the relationships:

The MIDI device itself is represented by the CoreMidi.MidiDevice class. Devices can contain one or more entities (CoreMidi.MidiEntity). For example a MIDI device could contain two independent MIDI tone generators. Each Entity contains a series of endpoints which are either sources or destintions. Both MIDI sources and MIDI destinations are encapsulated by the CoreMidi.MidiEntity class.

To start with MIDI, you will need to create a CoreMidi.MidiClient object. This object is the gateway between your application and the MIDI server process. You subscribe to the events that this object raises to track devices being added, removed and to changes in their properties and setup configuration.

You also use the to create input ports and output ports. The input ports raise the event when new MIDI data is available and you can use the CoreMidi.MidiPacketsEventArgs.Packets property in the arguments received to get the data out

See the class for an example of how to set things up.

To use networked MIDI connections, you need to enable the network session and set its connection policy, like this:

c# Example

var session = MidiNetworkSession.DefaultSession;
session.Enabled = true;
session.ConnectionPolicy = MidiNetworkConnectionPolicy.Anyone;
	

To connect to a remote MIDI network host you use the , like this:

c# Example

var host = MidiNetworkHost.Create ("My Session", "myhost.xamarin.com", 5004);
var connection = MidiNetworkConnection.FromHost (host); 
	

Classes

TypeReason
IOErrorEventArgsProvides data for the CoreMidi.IOErrorEventArgs.IOError event.
MidiGlobal methods and constants for using CoreMidi.
Midi+NotificationsNotification posted by the CoreMidi.Midi class.
MidiClientMain entry point to use MIDI in MacOS X and iOS.
MidiDeviceRepresents a MIDI device (typically they represent a hardware device, but virtual devices also exist). Devices can contain one or more entities.
MidiEndpointEndpoints represent an individual source or destination on the MIDI stream.
MidiEntityA CoreMidi.MidiObject that represents a sub-component of a CoreMidi.MidiDevice.
MidiErrorErrors raised by the CoreMIDI stack.
MidiExceptionException raised by Midi methods.
MidiNetworkConnectionA connection to a MIDI network host, using a CoreMidi.MidiNetworkSession.
MidiNetworkConnectionPolicyAn enumeration whose values specify which hosts are eligible to connect to a MIDI network session.
MidiNetworkHostA remote MIDI host.
MidiNetworkSessionA singleton class that maintains the CoreMidi.MidiNetworkConnections between various MIDI entities.
MidiObjectBase class for the CoreMidi.MidiClient, CoreMidi.MidiPort, CoreMidi.MidiEntity, CoreMidi.MidiDevice and CoreMidi.MidiEndpoint classes.
MidiPacketEncapsulates a series of MIDI events.
MidiPacketsEventArgsProvides data for the CoreMidi.MidiPacketsEventArgs.MessageReceived and CoreMidi.MidiPacketsEventArgs.MessageReceived events.
MidiPortInput and Output ports.
ObjectAddedOrRemovedEventArgsProvides data for the CoreMidi.ObjectAddedOrRemovedEventArgs.ObjectAdded and CoreMidi.ObjectAddedOrRemovedEventArgs.ObjectRemoved events.
ObjectPropertyChangedEventArgsProvides data for the CoreMidi.ObjectPropertyChangedEventArgs.PropertyChanged event.