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 SoundIO backend!");
            }

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

                _sessions.Add(session);

                return(session);
            }
        }
 internal void Unregister(SoundIoHardwareDeviceSession session)
 {
     lock (_lock)
     {
         _sessions.Remove(session);
     }
 }
Exemple #3
0
 internal bool Unregister(SoundIoHardwareDeviceSession session)
 {
     return(_sessions.TryRemove(session, out _));
 }