internal void Unregister(SDL2HardwareDeviceSession session)
 {
     lock (_lock)
     {
         _sessions.Remove(session);
     }
 }
        public IHardwareDeviceSession OpenDeviceSession(Direction direction, IVirtualMemoryManager memoryManager, SampleFormat sampleFormat, uint sampleRate, uint channelCount)
        {
            if (channelCount == 0)
            {
                channelCount = 2;
            }

            if (sampleRate == 0)
            {
                sampleRate = Constants.TargetSampleRate;
            }

            if (direction != Direction.Output)
            {
                throw new NotImplementedException("Input direction is currently not implemented on SDL2 backend!");
            }

            lock (_lock)
            {
                SDL2HardwareDeviceSession session = new SDL2HardwareDeviceSession(this, memoryManager, sampleFormat, sampleRate, channelCount);

                _sessions.Add(session);

                return(session);
            }
        }
 internal bool Unregister(SDL2HardwareDeviceSession session)
 {
     return(_sessions.TryRemove(session, out _));
 }