# SDL\_mixer fork, any interest in changes from upstream?

**URL:** <https://discourse.libsdl.org/t/sdl-mixer-fork-any-interest-in-changes-from-upstream/21405>\
**Category:** SDL Development\
**Created:** [June 8, 2015, 11:11am UTC](https://discourse.libsdl.org/t/sdl-mixer-fork-any-interest-in-changes-from-upstream/21405 "2015-06-08T11:11:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Braden\_Obrzut](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/braden_obrzut/32/2487_2.png) [@Braden\_Obrzut](https://discourse.libsdl.org/u/Braden_Obrzut)\
**Post date:** [June 8, 2015, 11:11am UTC](https://discourse.libsdl.org/t/sdl-mixer-fork-any-interest-in-changes-from-upstream/21405/1 "2015-06-08T11:11:25Z")

</div>

Hi,

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.

1. 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.

2. 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.

3. The above was prompted by the inclusion of Opus support as I needed  
to support both 44.1kHz and 48kHz sounds.

4. 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.

5. 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.)

6. 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.

7. 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:  
[https://bitbucket.org/Blzut3/sdl\_mixer-for-ecwolf/commits/all](https://bitbucket.org/Blzut3/sdl_mixer-for-ecwolf/commits/all)

Not sure if any of that is of interest for upstream?

- Braden “Blzut3” Obrzut

---

<div class="post-metadata">

**Author:** ![Kai\_Sterker](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/kai_sterker/32/101_2.png) [@Kai\_Sterker](https://discourse.libsdl.org/u/Kai_Sterker)\
**Post date:** [August 4, 2016, 8:41am UTC](https://discourse.libsdl.org/t/sdl-mixer-fork-any-interest-in-changes-from-upstream/21405/2 "2016-08-04T08:41:25Z")

</div>

> I work on a Wolfenstein 3D source port called ECWolf. […] I decided to  
> fork SDL\_mixer  
> for my purposes, which allowed me to add several other features.  
> […]  
> 3. The above was prompted by the inclusion of Opus support as I needed to  
> support  
> both 44.1kHz and 48kHz sounds.

Official Opus support for SDL\_mixer would be something that would greatly  
interest me. Apart from your own fork, I also came across  
[SDL :: View topic - Ogg Opus support in SDL\_mixer](https://forums.libsdl.org/viewtopic.php?t=10169), but this looks like it  
breaks API compatibility?

Is there any plan of including this, that, or another implementation? Do  
other people use any of the forks above and can recommend one? (Though I am  
kind of reluctant to include or require a patched version of SDL\_mixer to  
compile my game)

KaiOn Mon, Jun 8, 2015 at 1:11 PM, Braden Obrzut wrote:
