Example #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _session.Dispose();
     }
 }
Example #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Tell the hardware session that we are ending.
                _hardwareDeviceSession.PrepareToClose();

                // Unregister all buffers

                while (TryPopReleasedBuffer(out AudioBuffer buffer))
                {
                    _hardwareDeviceSession.UnregisterBuffer(buffer);
                }

                while (TryPopPlayingBuffer(out AudioBuffer buffer))
                {
                    _hardwareDeviceSession.UnregisterBuffer(buffer);
                }

                // Finally dispose hardware session.
                _hardwareDeviceSession.Dispose();

                _bufferEvent.Signal();
            }
        }