You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been testing a web build of a game I'm developing. I've gotten things to work but the audio sometimes skips on my web build, especially when the FPS drops. On the native Linux build, there's no audio skipping even when I stress test the renderer and go to low FPS. I've read SDL handles audio on a separate thread so this makes sense.
However, this does not appear to be the case in Emscripten. Audio performance appears to be tied to the main thread in some way. Is this a limitation of Emscripten? Can this be improved on SDL's side? Or is there something special I need to do for Emscripten in my code?
The text was updated successfully, but these errors were encountered:
Emscripten (rather, web browsers generally) run one task at a time, single-threaded. There are exceptions to this, but generally that's true.
Which is to say: the audio upkeep code (which calls your SDL audio callback) doesn't run until your app returns from its mainloop function.
You have to return as fast as possible, but it's possible you can open the SDL audio device with more samples buffered to let the audio continue through drops in framerate.
Eventually we might be able to move audio to a web worker to solve this, but I don't think browsers are there atm.
I've been testing a web build of a game I'm developing. I've gotten things to work but the audio sometimes skips on my web build, especially when the FPS drops. On the native Linux build, there's no audio skipping even when I stress test the renderer and go to low FPS. I've read SDL handles audio on a separate thread so this makes sense.
However, this does not appear to be the case in Emscripten. Audio performance appears to be tied to the main thread in some way. Is this a limitation of Emscripten? Can this be improved on SDL's side? Or is there something special I need to do for Emscripten in my code?
The text was updated successfully, but these errors were encountered: