nxdk icon indicating copy to clipboard operation
nxdk copied to clipboard

Add SDL_mixer support

Open PaulMDemers opened this issue 6 months ago • 6 comments

Summary

Adds SDL_mixer support to nxdk as an SDL2 companion library.

This first pass enables the core SDL_mixer library with WAV/chunk playback support only. Compressed/music codec support such as OGG, MP3, MOD, MIDI, and FLAC is intentionally deferred to follow-up work so the initial integration stays small and reviewable.

Changes

  • Add lib/sdl/SDL_mixer submodule
  • Build libSDL2_mixer.lib when NXDK_SDL = y
  • Enable SDL_mixer core + MUSIC_WAV
  • Add lib/pkgconfig/SDL2_mixer.pc
  • Add samples/sdl_mixer
  • Update README SDL library summary

SDL_mixer submodule

The SDL_mixer submodule points at PaulMDemers/SDL_mixer, branch nxdk-sdl-mixer.

That branch is based on SDL_mixer release-2.0.4 and contains one small nxdk compatibility change: use the existing strtok() path for XBOX builds instead of the Windows strtok_s() path.

Verification

Built successfully on Windows/MSYS2 with:

make -C samples/sdl_mixer

This produced:

  • lib/libSDL2_mixer.lib
  • samples/sdl_mixer/bin/default.xbe
  • samples/sdl_mixer/nxdk sample - SDL2_mixer.iso

The sample generates a small in-memory WAV tone, loads it through Mix_LoadWAV_RW, and plays it through SDL_mixer.

PaulMDemers avatar May 20 '26 23:05 PaulMDemers

I don't think this should be merged. See reasons in https://github.com/XboxDev/nxdk/pull/601


use the existing strtok() path for XBOX builds instead of the Windows strtok_s() path.

Sounds like upstream should check for __STDC_LIB_EXT1__ instead, then nxdk would work without changes. nxdk could also add a dummy wrapper for strtok_s (upstream in pdclib?) or to the WIN32 code (as part of the win32 libc).

JayFoxRox avatar May 22 '26 09:05 JayFoxRox

Is there any recent developments to adding SDL2_mixer to the nxdk? My project requires SDL2_mixer, and I might possibly assist getting the full SDL2_mixer to the SDK.

tifasoftware avatar Jun 11 '26 01:06 tifasoftware

@tifasoftware the work hasn't been forgotten, I am distracted with another project at the moment.

This port currently is just the initial base WAV support, additional help is more than welcome. :)

It'll be probably a week or two before I'm back working on libraries.

PaulMDemers avatar Jun 11 '26 01:06 PaulMDemers

That's absolutely okay, take your time. I too can get distracted with other parts of my game engine too. I'll probably be working on my other ports to the PS2, GameCube, and the Dreamcast in the meantime.

tifasoftware avatar Jun 11 '26 15:06 tifasoftware

My project also will need ogg support, but I'll try to help in any way i can in the future

tifasoftware avatar Jun 11 '26 15:06 tifasoftware

Your demo compiled successfully on Ubuntu 26.04, however I don't think I can hear your audio clips in XEMU.

tifasoftware avatar Jun 17 '26 17:06 tifasoftware