public void Close() { outputDevice.Close(); System.Threading.Thread.Sleep(200); // fixes delay during initial playing, possibly due to midi device initialization }
private void btnReceiveOut_Click(object sender, EventArgs e) { if (listBox2.SelectedItem == null) MessageBox.Show("No device selected!"); else { outDevice = (OutputDevice)listBox2.SelectedItem; outDevice.Open(); if (comboBox1.SelectedItem != null) outDevice.SendNoteOn(Channel.Channel1, (Pitch)comboBox1.SelectedItem, trackBar1.Value); outDevice.Close(); } }