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; } }