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

            if (disposing)
            {
                _channelMessageMemoryStream.Dispose();
                _channelEventReader.Dispose();
            }

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

            _disposed = true;
        }
Example #2
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                if (_handle == IntPtr.Zero)
                {
                    return;
                }

                _channelMessageMemoryStream.Dispose();
                _channelEventReader.Dispose();
            }

            UnprepareSysExBuffer();
            DestroyHandle();

            _disposed = true;
        }