WasapiOut EventStyle=True causes Exception "Specified argument was out of the range of valid values"


When using WasapiOut with EventStyle=True and AudioClientShareMode = AudioClientShareMode.Shared, this exception occurs when playing a file:
Exception: Specified argument was out of the range of valid values.
Parameter name: value. StackTrace:    at CSCore.SoundOut.WasapiOut.set_Latency(Int32 value)
   at CSCore.SoundOut.WasapiOut.InitializeInternal()
   at CSCore.SoundOut.WasapiOut.Initialize(IWaveSource source)
   at Dopamine.Core.Audio.CSCorePlayer.PlayASound() in D:\Workspaces\VSOnline\Dopamine\Dev\Dopamine\Dopamine.Core\Audio\CSCorePlayer.vb:line 128
   at Dopamine.Core.Audio.CSCorePlayer.Play(String iUri) in D:\Workspaces\VSOnline\Dopamine\Dev\Dopamine\Dopamine.Core\Audio\CSCorePlayer.vb:line 212
   at Dopamine.Services.PlaybackService.TryPlay(TrackInfo iTrack) in D:\Workspaces\VSOnline\Dopamine\Dev\Dopamine\Dopamine.Services\Playback\PlaybackService.vb:line 396
This doesn't happen when using EventStyle=True and AudioClientShareMode = AudioClientShareMode.Exclusive.

Is it always required to use EventStyle=True with AudioClientShareMode.Exclusive?
Closed Mar 17, 2015 at 9:18 PM by filoe


filoe wrote Mar 17, 2015 at 12:54 PM

rgodart wrote Mar 17, 2015 at 8:35 PM

The issue seems fixed. Although I had to create a "hybrid" cscore build using the latest commit on the master branch and the recent changes to WasapiOut.cs, as the 1_1 branch doesn't compile (missing .cs files here and there).

filoe wrote Mar 17, 2015 at 9:18 PM

Well the version_1_1 branch is currently not stable. Will be merged with the master branch as soon as it is stable for version 1.1.

filoe wrote Mar 18, 2015 at 9:37 AM

Just fixed another little mistake where wasapiout could not be resumed (in exclusive mode and eventsync).