First off thanks a lot for this library. I’ve been playing around with SDL2 for a bit more than a year now and believe I am still far from having grasped all its concepts entirely.
The project I’m working on for now is the rewrite of a game, Bermuda Syndrome, which was published by Gregory Montoir a few years ago. I’m currently stuck at some point enhancing sound playing with the custom AVI player. The player works perfectly fine though; I have just one question about audio.
The game includes SDL 2.0.9 and SDL_Mixer 2.0.4. I have implemented a volume setting (from 1 to 128) on the command line and it works great with MIX chunks and MIX music. The custom AVI player has been completely re-written and I’d like to use SDL_QueueAudio to send the audio samples that were fetched from the AVI sound chunks. The thing is I’d like to set the volume according to the main volume parameter I have for the game.
I have checked MIX_xxx functions, which do have a volume parameter but those work on chunks and I perceive they play an audio chunk then stop and I need continuous buffer feed. That’s why I’ve used SDL_QueueAudio. Just that that function doesn’t allow changing the volume of the raw audio samples… unless I’m writing a callback, which is exactly what I’d like to avoid.
I’ve also checked SDL_MixAudioFormat() but it takes two buffers and I have only one: the one containing raw samples from the AVI audio chunk. Writing my own callback would require me to account for different audio formats… which is exactly what SDL does.
I may certainly have missed something so does anyone have some hints?
Thanks a lot in advance.