public void CloseIn() { if (midiIn != null) { midiIn.Stop(); midiIn.OnLongMsg -= OnLongMessage; midiIn.OnShortMsg -= OnShortMessage; midiIn.Close(); midiIn = null; } }
public void OpenIn(int index) { CloseIn(); try { midiIn = new MidiIn(index); midiIn.OnLongMsg += OnLongMessage; midiIn.OnShortMsg += OnShortMessage; midiIn.Start(); } catch (Exception ex) { Trace.WriteLine("Error occured: " + ex.ToString()); } }