Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Unassigned: Exception when initializing device under WASAPI Exclusive mode [16463]

$
0
0
I'm trying to initialize a device in WASAPI exclusive mode and am seeing this exception:

> System.Runtime.InteropServices.COMException (0x88890019): Exception from HRESULT: 0x88890019
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at NAudio.CoreAudioApi.AudioClient.Initialize(AudioClientShareMode shareMode, AudioClientStreamFlags streamFlags, Int64 bufferDuration, Int64 periodicity, WaveFormat waveFormat, Guid audioSessionGuid) in C:\src\naudio-trunk\NAudio\CoreAudioApi\AudioClient.cs:line 63
at NAudio.Wave.WasapiOut.Init(IWaveProvider waveProvider) in C:\src\naudio-trunk\NAudio\Wave\WaveOutputs\WasapiOut.cs:line 370
at NAudio.Wave.WaveExtensionMethods.Init(IWavePlayer wavePlayer, ISampleProvider sampleProvider, Boolean convertTo16Bit) in C:\src\naudio-trunk\NAudio\Wave\WaveExtensionMethods.cs:line 35

After some digging I found out the likely culprit is buffer alignment - the error code is AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED and MSDN states that "The caller must call Initialize again with the aligned buffer size." (http://msdn.microsoft.com/en-us/library/windows/desktop/dd370875(v=vs.85).aspx)

In AudioClient.cs (NAudio trunk) I see that the Initialize() method is only called once, meaning if it fails, it's not called again with an aligned buffer size. I'm not sure how to approach it but found this interesting source: http://blogs.msdn.com/b/matthew_van_eerde/archive/2009/04/03/sample-wasapi-exclusive-mode-event-driven-playback-app-including-the-hd-audio-alignment-dance.aspx
Comments: thanks for reporting. Do you know how to reproduce this issue?

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>