Hi all,
recently have encountered an issue while playing multiple SoundEffectInstances in parallel. Tried to search but without success, all i found were recommendations to play in parallel through Tasks, try to stay around 4 active instances, dispose each instance after playing. Have to say the stability is better while trying to do so but game still crashes. Believe doing something wrong or is it a known bug in the source of SharpDX? Was not able to find a “known bug”, but noticed there is plenty of other issues with “SharpDX.XAudio2”, while was trying to find a solution.
Got to this exception:
System.AccessViolationException
HResult=0x80004003
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
System.NullReferenceException: Object reference not set to an instance of an object.
at SharpDX.XAudio2.SourceVoice.GetState(Int32 flags)
at Microsoft.Xna.Framework.Audio.SoundEffectInstance.PlatformGetState()
at Microsoft.Xna.Framework.Audio.SoundEffectInstancePool.Update()
at Microsoft.Xna.Framework.FrameworkDispatcher.Update()
at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.UAPGamePlatform.<>c.<Start>
Primarily targeting XBOXONE but testing on PC as well, its and UWP app.
What is the best and safest way to use multiple Sound Effects at once please?
Thanks,
Marek.