I just migrated my project from SDL1.2 to SDL2, and despite the migration guide saying audio should work pretty much out of the box, no audio was played after recompilation. SDL_OpenAudio returned 0 and my audio callback was being called; the desired and obtained AudioSpec structs were identical but the “samples” value (upped from 512 to 2048). Apparently, reducing the sample rate from 96KHz to 44.1 KHz restored sound playback, but 96KHz sound was working perfectly fine on SDL1.2.
Tested on macOS Sierra (10.12.3), haven’t tested on Linux or Windows yet. Using SDL2-2.0.5.
Edit: Tested on Linux Mint 64-bit and 96KHz audio seems to work. Seems like a bug in the macOS port of SDL2?
Edit 2: SDL2-2.0.4 seems to work on macOS. This is a bug introduced in 2.0.5 it appears.
We have dramatically rewritten the audio conversion code since SDL 2.0.5; this is likely working with the latest in revision control (which will become 2.0.6 pretty soon).
If you’re inclined, please test the latest revision and see if it helps you.
Sorry to bump this topic after almost a year, but I’ve tested again with SDL 2.0.8 and the bug is still there. Audio won’t play in 96KHz unless I set samples to 2048.