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
Add SDL_MIXER feature flag for conditional audio mixing support
Introduce ENABLE_SDL_MIXER feature flag to conditionally compile
SDL2_mixer-dependent audio code. This allows SDL2 graphics support
without the problematic SDL2_mixer library in emscripten builds.
Changes:
1. Makefile:
- Add ENABLE_SDL_MIXER feature flag (default: 1)
- Update GNU make version requirement: 3.81+ for $(info) function
- Disable SDL_MIXER for emscripten builds (override = 0)
- Conditionally link SDL2_mixer only when ENABLE_SDL_MIXER=1
- Set ENABLE_SDL_MIXER=0 when pkg-config check fails
2. src/syscall_sdl.c:
- Wrap #include <SDL_mixer.h> with #if RV32_HAS(SDL_MIXER)
- Wrap Mix_* variable declarations (mid, sfx_chunk)
- Wrap Mix_* function calls in init_audio() and shutdown_audio()
- Wrap audio handler functions (sfx_handler, music_handler,
stop_music, set_music_volume, play_sfx, play_music)
- Wrap pthread_create calls for audio threads
- Wrap syscall handlers (PLAY_MUSIC, PLAY_SFX, SET_MUSIC_VOLUME,
STOP_MUSIC)
Strategy: Set ENABLE_SDL_MIXER=0 in Makefile before mk/wasm.mk is
included, so the RV32_FEATURE_SDL_MIXER macro is defined as 0 for
emscripten builds. This makes syscall_sdl.c skip all Mix_* code at
compile time, avoiding linkage errors.
Root cause: emscripten-ports/SDL2_mixer (archived Jan 2024) has
unfixable compilation warnings in music_modplug.c. The port system
enforces -sSTRICT -Werror which cannot be overridden.
Result: Games (Doom/Quake) work without audio mixing. SDL2 graphics
support remains functional. Non-emscripten builds retain full audio.
Note: mk/wasm.mk is intentionally left unchanged. The SDL_MIXER
disablement happens in Makefile before mk/wasm.mk inclusion.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments