Esempio n. 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)
            {
                _memoryStream.Dispose();
                _midiWriter.Dispose();
            }

            DestroyHandle();

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

            _disposed = true;
        }
Esempio n. 2
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

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

                DestroyHandle();

                _memoryStream.Dispose();
                _midiWriter.Dispose();
            }

            _disposed = true;
        }