NAudio icon indicating copy to clipboard operation
NAudio copied to clipboard

Fix a bug that WasapiCapture could not use exclusive mode

Open tt3333 opened this issue 1 year ago • 0 comments

When using exclusive mode with WasapiCapture, the InitializeCaptureDevice throws an exception. In #819 it says "you can't use it with WASAPI exclusive mode playback", but it seems that auto convert cannot be used in exclusive mode for recording as well as playback.

System.ArgumentException: Value does not fall within the expected range.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at NAudio.CoreAudioApi.AudioClient.Initialize(AudioClientShareMode shareMode, AudioClientStreamFlags streamFlags, Int64 bufferDuration, Int64 periodicity, WaveFormat waveFormat, Guid audioSessionGuid)
   at NAudio.CoreAudioApi.WasapiCapture.InitializeCaptureDevice()
   at NAudio.CoreAudioApi.WasapiCapture.StartRecording()

tt3333 avatar Feb 10 '24 02:02 tt3333