I have spent
three four hours trying to find out what was wrong when I left this "on hold" a few days ago. I haven't progressed too much... there's something silly here but I can't quite point where and the sound is not being output properly (there are gaps between samples and everything sounds like stuttering).
I added a simple class for dumping to WAV that I had done a few months ago, just to discard it was not SDL's fault (it wasn't, although PulseAudio gave me a couple of false alarms with its I'm going to sound distorted without you expecting it moments).
I am pretty sure that the bug is super ridiculously simple to fix (not that easy to find), and I have been staying here against the will of my sleepy, heavy eyelids, just in case the "A-HA!! moment" decided to materialise, but it hasn't happened. So I guess it's time to call it a day... and come back to this tomorrow :-(