I work on a Wolfenstein 3D source port called ECWolf. Awhile back
sampled music playback was added to the engine, however it was found
that SDL_mixer didn’t provide facilities to both use the built in music
player and use a callback to run the AdLIb/PC Speaker emulator. So I
decided to fork SDL_mixer for my purposes, which allowed me to add
several other features. It includes the following.
Music player is always active and is mixed in after the “music
player” callback. This essentially just involved changing the internal
music player to assume that the buffer is already initialized.
The resampling function from SDL (SDL_ConvertAudio) is copy & pasted
in with the slow resampler uncommented. The comment there suggests that
some cards can’t handle buffers of arbitrary sizes, however, it’s
completely irrelevant to SDL_mixer as SDL_mixer tries to fill in as much
data as possible (reading more from the file if need be). So it seems
to work just fine here.
The above was prompted by the inclusion of Opus support as I needed
to support both 44.1kHz and 48kHz sounds.
Loop tag support for Vorbis, FLAC, and Opus so music can be
seamlessly looped while having a fade out if played outside of the game.
Fixed a race condition in the Windows MIDI code. (Although this is
only one of the thousand issues with SDL_mixer’s MIDI code. So it still
crashes constantly on Windows and on Linux with fluidsynth there seems
to be a massive memory leak resulting in over 8GB of memory being used
after just a few song changes. I haven’t even begun to look into that
as I need much more powerful MIDI code than what SDL_mixer can offer.)
SDL_mixer uses SDL’s WAV loader, but tries to use SDL_free on the
buffer instead of SDL_FreeWAV. This results in a crash in some cases.
It’s built using CMake, although this is the most basic CMake script
possible as I just needed it to work and is thus geared more for my
purposes of statically linking in my desired configuration.
The repository for my fork is here:
Not sure if any of that is of interest for upstream?
- Braden “Blzut3” Obrzut