See Also: MidiClient Members
The MidiClient class is your gateway to communicate with the MIDI subsystem on MacOS and iOS.
You typically will create an instance of MidiClient with a name that identifies this particular client, connect to the various events that are exposed to this class and create both input and output midi ports using the MidiClient.CreateInputPort(string)MidiClient.CreateOutputPort(string) methods.
c# Example
client = new MidiClient ("CoreMidiSample MIDI CLient"); client.ObjectAdded += delegate(object sender, ObjectAddedOrRemovedEventArgs e) { Console.WriteLine ("Object {0} added to {1}", e.Child, e.Parent); }; client.ObjectRemoved += delegate(object sender, ObjectAddedOrRemovedEventArgs e) { Console.WriteLine ("Object {0} removed to {1}", e.Child, e.Parent); }; client.PropertyChanged += delegate(object sender, ObjectPropertyChangedEventArgs e) { Console.WriteLine ("Property {0} changed on {1}", e.PropertyName, e.MidiObject); }; client.ThruConnectionsChanged += delegate { Console.WriteLine ("Thru connections changed"); }; client.SerialPortOwnerChanged += delegate { Console.WriteLine ("Serial port changed"); }; // // Create your input and output ports // outputPort = client.CreateOutputPort ("CoreMidiSample Output Port"); inputPort = client.CreateInputPort ("CoreMidiSample Input Port"); // Print out packets when we receive them inputPort.MessageReceived += delegate(object sender, MidiPacketsEventArgs e) { Console.WriteLine ("Got {0} packets", e.Packets.Length); };
The following events will be raised on your MidiClient instance: MidiClient.IOError, MidiClient.ObjectAdded, MidiClient.ObjectRemoved, MidiClient.PropertyChanged, MidiClient.SerialPortOwnerChanged, MidiClient.SetupChanged and MidiClient.ThruConnectionsChanged