/// <summary> /// Closes this input device. /// </summary> /// <exception cref="InvalidOperationException">The device is not open or is still /// receiving.</exception> /// <exception cref="DeviceException">The device cannot be closed.</exception> public void Close() { if (isInsideInputHandler) { throw new InvalidOperationException("Device is receiving."); } lock (this) { CheckOpen(); isClosing = true; if (LongMsgBuffers.Count > 0) { CheckReturnCode(Win32API.midiInReset(handle)); } //Destroy any Long Message buffers we created when opening this device. //foreach (IntPtr buffer in LongMsgBuffers) //{ // if (DestroyLongMsgBuffer(buffer)) // { // LongMsgBuffers.Remove(buffer); // } //} CheckReturnCode(Win32API.midiInClose(handle)); isOpen = false; isClosing = false; } }
/// <summary> /// Closes this input device. /// </summary> /// <exception cref="InvalidOperationException">The device is not open or is still /// receiving.</exception> /// <exception cref="DeviceException">The device cannot be closed.</exception> public void Close() { if (isInsideInputHandler) { throw new InvalidOperationException("Device is receiving."); } lock (this) { CheckOpen(); CheckReturnCode(Win32API.midiInClose(handle)); isOpen = false; } }