Description
Several audio decoders (libFLAC, libvorbis, etc) want to provide their decoded PCM output as arrays of channels, so to get the usual PCM stream, you have to interleave them:
// a given sample is at `pcm_channels[channel_num][frame_num]`.
const float first_stereo_sample_frame[] = { pcm_channels[0][0], pcm_channels[1][0] };
const float second_stereo_sample_frame[] = { pcm_channels[0][1], pcm_channels[1][1] };
const float third_stereo_sample_frame[] = { pcm_channels[0][2], pcm_channels[1][2] };
It might be nice if SDL_AudioStream could accept input as these original separate arrays and manage interleaving into a single PCM buffer itself.
This allows some garbage code to be removed from SDL_mixer, but also allows us to have a central point where we can manage interleaving (possibly using SIMD), and maybe move the newly-allocated interleaved buffer directly into an SDL_AudioStream track without an extra copy.
Something like:
bool SDL_PutAudioStreamDataSeparateChannels(SDL_AudioStream *stream, const void **channels, int len);
Not (currently) interested in an equivalent for getting data; this just makes it easier to get non-interleaved data into the existing system. Once it goes into the stream, it gets interleaved.