Currently I'm working up the courage to touch the Web Audio API
-
Currently I'm working up the courage to touch the Web Audio API
Researching it, I see why Emscripten's implementation of SDL's audio stuff was so bad...
The JS that generates new audio samples must run in a different thread and can only generate 128 samples per function call. Very different from how you would naturally make something in SDL.
-
Currently I'm working up the courage to touch the Web Audio API
Researching it, I see why Emscripten's implementation of SDL's audio stuff was so bad...
The JS that generates new audio samples must run in a different thread and can only generate 128 samples per function call. Very different from how you would naturally make something in SDL.
Web Audio API also has each channel in separate buffers, not interleaved.
My plan is to have game generate samples to a circular interleaved buffer, which the platform layer can pull from in any amount is natural for it, 128 samples or othrwise.
For web this means going from interleaved to not, to back again to play the song. But this will be better for native PC, which I care about more so...
-
Web Audio API also has each channel in separate buffers, not interleaved.
My plan is to have game generate samples to a circular interleaved buffer, which the platform layer can pull from in any amount is natural for it, 128 samples or othrwise.
For web this means going from interleaved to not, to back again to play the song. But this will be better for native PC, which I care about more so...
@wildrose fwiw, this does sound pretty normal for a low-level audio API