public void SetOutputDevice(IOutputDevice outputDevice) { if (_outputDevice != null && _outputDevice.IsOpen) { _outputDevice.Close(); } if (outputDevice != null) { _outputDevice = outputDevice; _device.OutputDevice = _outputDevice; if (!_outputDevice.IsOpen) { _outputDevice.Open(); } } else { _outputDevice = null; _device.OutputDevice = null; } OnPropertyChanged(nameof(OutputDevice)); }
public void Close() { outputDevice.Close(); System.Threading.Thread.Sleep(200); // fixes delay during initial playing, possibly due to midi device initialization }