ALmixer vs. SDL_mixer

The ALmixer API is heavily influenced and inspired by SDL_mixer, though there is one major conceptual design difference. ALmixer doesn't divide sound and music playback into two separate play APIs. Instead, there is one unified play API and you specify via the load API whether you want the audio resource loaded as a stream or completely preloaded. This allows you to have any arbitrary number of streaming sources playing simultaneously (such as music and speech) unlike SDL_mixer where you are limited to only one "music" channel.

A less major conceptual design difference is every "Channel" API has a corresponding "Source" API.  Every "channel" (in the SDL_mixer definition context) maps to a corresponding OpenAL source id. You can use this source ID directly with OpenAL API commands to utilize OpenAL effects such as position, Doppler, etc. Convenience APIs are provided to let you convert channel numbers to source ids and vice-versa.

Another change which is a pet-peev of mine with SDL_mixer is the lack of a user_data parameter in callbacks. ALmixer callbacks allow you to pass user_data (aka context) pointers through the callback functions.


Why would you want to use ALmixer over SDL_mixer?

- You can play more than one "music" channel with ALmixer. With ALmixer, there is no artificial limit or distinction between "music" and "sounds". Instead, you specify if you want to preload a sound "fully" or as a "stream" and the play API automatically/transparently does the right thing. This means you can have multiple streaming sounds playing at the same time like music and speech.

- The callback API allows for void* userdata (a.k.a. context) to be passed through. This is horribly useful, like when you need to get a C++ object instance through so you can call a method during the callback.

- Uses OpenAL as the audio engine instead of SDL.

- Not subject to known SDL and SDL_mixer bugs/limitations

- You can utilize OpenAL for additional features and effects.

- Used in multiple commercial game engines, pushed particularly hard on mobile.


Why would you want to use SDL_mixer over ALmixer?

- ALmixer is newer, less proven code.

- OpenAL while an industry cross-platform standard, is still not as ubiquitous as SDL.

- OpenAL may have a different set of bugs and there are different implementations of OpenAL which may have different bugs.

- SDL_mixer effects are not ported. (You should utilize OpenAL effects instead.)


Copyright © PlayControl Software