private bool openMidiOutput() { outDialog = new OutputDeviceDialog(); if (OutputDevice.DeviceCount == 0) { MessageBox.Show("No MIDI output devices available.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } else { try { outDevice = new OutputDevice(outDeviceID); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } } // Flag that MIDI output has successfully initialized midiStarted = true; btn_startMIDI.Text = "Stop MIDI"; btn_startMIDI.BackColor = Color.LightCoral; return(true); }
public void Disconnect() { if (this.inDevice != null) { this.inDevice.Close(); } if (this.outDevice != null) { this.outDevice.Close(); } this.inpdev = null; this.outpdev = null; }