Hi all! I’m trying to convert some of the Mini Micro API over to SDL2 (for a new game framework called Soda). In particular, today I’m pondering how to implement Sound.play(volume, pan, speed).
I’m reading over the docs for SDL_mixer, but it doesn’t seem to offer any control over pan and speed (despite having a more complex API than I would prefer). I also looked at Simple SDL2 Audio, but it too seems to offer only volume, not pan or speed.
Is there any off-the-shelf solution for this sort of control? Or would I need to write my own mixer — and if so, where might I find a good beginner’s guide to that?
Just to follow up: while Akismet was holding this post, I went ahead and did it on my own. It did involve writing my own mixer, but it wasn’t all that hard to do. SDL2 does a really nice job providing the low-level support needed to do whatever you might want at the higher levels. I’ve been using SDL2 for less than a week, and I’m super impressed so far.
In case it’s useful to anyone, you can see my custom audio code here. Supports volume, pan, and speed. Does not yet support looping, but that’ll be next, and shouldn’t cause any difficulty (just a matter of wrapping around in the buffer rather than marking it done — though I will also need to add some way to stop it).