Example #1
0
        /// <summary>
        /// Releases the unmanaged resources used by the MIDI device class and optionally releases
        /// the managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to
        /// release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                _bytesToMidiEventConverter.Dispose();
            }

            StopEventsListening();
            DestroyHandle();
            UnprepareSysExBuffer(_sysExHeaderPointer);

            _disposed = true;
        }
        /// <summary>
        /// Releases the unmanaged resources used by the MIDI device class and optionally releases
        /// the managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to
        /// release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                _midiEventToBytesConverter.Dispose();
                _bytesToMidiEventConverter.Dispose();
            }

            DestroyHandle();

            foreach (var sysExHeaderPointer in _sysExHeadersPointers)
            {
                UnprepareSysExBuffer(sysExHeaderPointer);
            }

            _disposed = true;
        }