Desktop: the music was played as one SDL_mixer chunk per block, each started
when the previous one ended, at frame precision: a gap of up to a frame at each
block (measured on the real Freedoom song: 8 gaps, 371 ms of silence in 5 s).
- php-sdl-mixer (docker/ext/php-sdl-mixer-stream.patch): a ring buffer fed by
PHP (JumPHP_StreamOpen / Push / Buffered / Clear / Volume / Close), read by
Mix_HookMusic on SDL's audio thread, mixed with the sound effects by SDL_mixer,
silence when empty. Resampling to the device rate in C.
- Mix_VolumeMusic does not reach the hook: the stream volume is set by PHP.
- PcmStream (desktop): uses the stream when the binding has it, the old chunks
otherwise. The browser path is unchanged.
- Same functions in the desktop image and in the WebAssembly engine.
- Measured in capture (SDL disk driver): 0 gaps, the right frequency, sound
effects and music in the same output. Listening test not done yet.
Co-Authored-By: Claude Opus 5.5 <[email protected]>