How could one fade out all the currently playing audio? Additionally is it possible to fade only specific samples?
So this can be useful to other readers, please assume the code is the Allegro5 Audio tutorial code from the Allegro wiki.
I was thinking bool al_set_sample_instance_gain(ALLEGRO_SAMPLE_INSTANCE *spl, float val) could be used, is this the best way? Also could someone please explain the relationship between gain, volume, the float val?
Thanks
Good luck with this. I don't like how Allegro 5 handles audio. It is convoluted. I gave up on doing very much with it.
I think what you want is al_attach_sample_instance_to_mixer and al_set_mixer_gain (5.1.X).
I don't like how Allegro 5 handles audio. It is convoluted. I gave up on doing very much with it.
I'm sorry to hear that. I found the audio API a bit confusing at first but gradually began to realize that it's like that for a reason. After that, things started to seem less confusing.
Edgar's right. That's exactly what you want.
Also could someone please explain the relationship between gain, volume, the float val?
Gain is volume. 1.0 is 100%. Sample gain is applied to the sample before any gain from mixers gets applied.