-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty Queue Crash in DynamicSoundEffectInstance.PlatformUpdateQueue() #8137
Comments
Are you using Threads or Tasks? |
I use Tasks to load SFX and Music. I don't think I'm using it anywhere to play anything though. I wrote some code that hooks into the BufferNeeded event from DynamicSoundEffectInstance in order to have more control over looping and stuff. See my gist below if that provides more context: |
Also, I forked MonoGame and made my own fix(???) to DynamicSoundEffectInstance.OpenAL.cs. I just wrapped everything in a try/catch and when an error is thrown it calls PlatformStop. I don't know what I'm doing, but I figured it might fix it for now.
|
Whenever Thread/Task and events are involved with sounds, it makes things hard to know if it's an actual bug or code sync'ing issues in developers' code. A quick look at your gist makes me thinking that you're loading all sounds each in their own thread at the same time, which might explain the problem. Regarding your changes in |
You're correct, I am loading my 200+ sound effects into memory with one Task each at boot. I'm also loading music similarly, the difference being it only loads the required songs for a level when starting it. It sounds like I shouldn't be though? I've never had a problem with this in the past year it has been this way. So instead of having one Task per sound effect/song, I could maybe have one Task that loads the requested assets one after the other? My "fix" of course is not suggested, that part of dev is a little out of my depth and I was just trying to ensure my game wouldn't crash randomly eheh... |
That's more advisable, yes. Otherwise there's a probable risk of having OpenAL mixing up buffers internally, which may cascade on other things. I don't know if in this present instance it is what cascades into breaking Your "fix" is likely just postponing an error. I believe that you'll run into other issues later on if you use it. Though fine enough as a local temp patch. |
Prerequisites
develop
branchMonoGame Version
3.8.1 HOTFIX
Which MonoGame platform are you using?
MonoGame Cross-Platform Desktop Application (mgdesktopgl)
Operating System
Windows 11
Description
My game crashed with the following during regular gameplay:
I see that there was a fix for this here: #7402
However it seems I'm still having this issue on 3.8.1 HOTFIX
Steps to Reproduce
It seemed to happen randomly while the game was playing.
Minimal Example Repo
No response
Expected Behavior
No random crash.
Resulting Behavior
Random crash.
Files
No response
The text was updated successfully, but these errors were encountered: