public void Dispose() { _inputDevice.ControlChange -= InputDevice_ControlChange; _inputDevice.NoteOn -= InputDevice_NoteOn; _inputDevice.NoteOff -= _inputDevice_NoteOff; _inputDevice.Nrpn -= _inputDevice_Nrpn; _inputDevice.ChannelPressure -= _inputDevice_ChannelPressure; _inputDevice.PitchBend -= _inputDevice_PitchBend; _inputDevice.PolyphonicKeyPressure -= _inputDevice_PolyphonicKeyPressure; _inputDevice.ProgramChange -= _inputDevice_ProgramChange; _inputDevice.Dispose(); _outputDevice.Dispose(); }
private void OnDestroy() { if (_midiOutput != null) { ClearPadLEDs(); _midiOutput.Close(); _midiOutput.Dispose(); } if (_midiInput != null) { _midiInput.Close(); _midiInput.Dispose(); } }