public void ConnectDevice( int index, int outputIndex) { InputDevice = new MidiInput(); if (InputDevice.Open(index)) { InputDevice.MessageReceived += new MidiMessageReceived(InputDevice_MessageReceived); InputDevice.Start(); Connected = true; } else { InputDevice = null; } OutputDevice = new MidiOutput(); if (OutputDevice.Open(outputIndex)) { Connected = true; } else { OutputDevice = null; } }
public void CloseDevice() { if (InputDevice != null) { InputDevice.Stop(); InputDevice.Close(); InputDevice = null; } if (OutputDevice != null) { OutputDevice.Close(); OutputDevice = null; } Connected = false; }