Should mix_channels() function use SDL_MixAudio() ?
Perhaps I'm missing something but when doing some changes on the ancient SDL_mixer 1.2, I have noticed that its mix_channels function calls SDL_MixAudio.
As we can read in the original 1.2 docs: Do not use this function for mixing together more than two streams of sample data. The output from repeated application of this function may be distorted by clipping, because there is no accumulator with greater range than the input (not to mention this being an inefficient way of doing it). Use mixing functions from SDL_mixer, OpenAL, or write your own mixer instead. (that reference to SDL_mixer itself is quite interesting in this context...)
To my surprise, this called stayed there even to this date: https://github.com/libsdl-org/SDL_mixer/blob/1bf7a798a7309b6cec1e1b3e95f04fba944b1118/src/mixer.c#L440 while SDL3's SDL_MixAudio still warns about not using it for more than two channels.
Considering that SDL_mixer supports up to 8 channels: https://github.com/libsdl-org/SDL_mixer/blob/1bf7a798a7309b6cec1e1b3e95f04fba944b1118/include/SDL3_mixer/SDL_mixer.h#L184
shouldn't this be rewritten into a custom mixing code for better efficiency / accuracy?
Yep! We’re working towards the SDL3 launch, and updating SDL_mixer is on the post-launch TODO list. If you’d like to pitch in, feel free!
This is resolved in SDL3_mixer.