public bool Close() { if (this._device == IntPtr.Zero) { return(true); } this._closing = true; bool started = this._started; this._lastError = Midi.MIDI_InReset(this._device); if (this._lastError == MIDIError.MIDI_OK) { this._started = false; if (started) { this.RaiseMessageReceived(MidiMessageEventType.Stopped, null); } } this._lastError = Midi.MIDI_InClose(this._device); if (this._lastError == MIDIError.MIDI_OK) { this._device = IntPtr.Zero; } this._closing = false; return(this._device == IntPtr.Zero); }