Page 1 of 1

Switching to libxmp from libmodplug for module music

Posted: Tue Aug 09, 2022 3:29 am
by TMC
The SDL_mixer library we use for audio has been making improvements in the last couple of years. They've just added support for using libxmp rather than libmodplug to play module music (.xm, .it, .s3m, .mod) and in the next version (2.8.0) libxmp will become the default library, so we're considering whether to switch straight to libxmp now on Windows and Linux (Mac will have to wait) since I'm updating the libraries anyway. If you use or compose module music please test whether the new library causes you any problems. libxmp seems to be quite actively developed and trying to match OpenMPT for accuracy.

Download it here. Drop in replacement for SDL2_mixer.dll in any default Windows (SDL2) nightly or stable build of the OHRRPGCE. libxmp-lite.dll is needed, but in future I'll probably combine it into SDL2_mixer.dll.
(If you look in g_debug.txt/c_debug.txt you can see libxmp is in use from the line:)
music_sdl2, SDL_Mixer 2.6.1 (44100Hz, Music decoders:WAVE,XMP,MOD,DRMP3,MP3,OGG,NATIVEMIDI,MIDI Sample decoders:WAVE,AIFF,VOC,MOD,MP3,OGG,MID)

I've already found a few tracks which libxmp seems to play better than libmodplug. In particular it doesn't suffer from a slight pause on looping from the end of certain tracks.

This new version of SDL_mixer also switches to using stb_vorbis to play .ogg and dr_mp3 to play .mp3, so you can compare those files too to check for differences, although I'm not expecting anything.

As a bonus, these new libraries are far smaller than the old ones, so SDL2_mixer.dll is a fraction its previous size. And you'll note I'm using libxmp-lite (.xm, .it, .s3m, .mod) instead of libxmp (which supports all of these), to keep it small (122kB). Disabling "archive depackers" and "ProWizard format loaders" reduces the libxmp.dll size to 400kB though from 490kB (-O2 build).