The new wasapi backend in 2.0.6 / hg returns AUDIO_F32LSB for me on
win10/x64, even if I request AUDIO_S16SYS: is this expected behavior?
If it matters, the game in question is quakespasm, and the relevant
sound code is here:
WASAPI only supports float32 samples (this is a WASAPI thing, not an SDL thing). You can have SDL transparently convert between what the system wants and what your app can provide:
This line in snd_sdl.c…
if (SDL_OpenAudio(&desired, &obtained) == -1)
…should pass a NULL instead of “&obtained” and then you’ll definitely get what you asked for, even if SDL has to convert data between your callback and the OS.
(Alternately, you can use SDL2’s SDL_OpenAudioDevice() function, which lets you specify which things you need vs what you can work with…so you can say “give me whatever sample rate and channels the hardware wants, but if you can’t give me Sint16 samples, you’ll need to convert just that part for me”). You’ll have to swap out a few other calls because SDL_OpenAudioDevice lets you open multiple pieces of sound hardware individually, so there are equivalent SDL2 functions that expect to operate on a device handle that SDL_OpenAudioDevice returns. In SDL2, SDL_OpenAudio and the rest of the 1.2 APIs are just wrappers for SDL_OpenAudioDevice and friends that always deal with device handle 1.)