protected virtual void Dispose(bool disposing) { if (disposing) { _session.Dispose(); } }
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(); } }