Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Setting stream mixers

This thread is locked; no one can reply to it. rss feed Print
Setting stream mixers
Restful Cargo
Member #16,106
October 2015

Hi guys. Looking for some clarification on mixing audio streams. Suppose I create an audio chain similar to what was suggested on the allegro docs:

                            / <---- SFX Mixer
Voice <-- Master Mixer <----
                            \ <---- Stream Mixer (Background Music)

So one mixer for sound effects and another for background music so to have discrete control over volume.

For sound effects if I call al_attach_sample_instance_to_mixer() I can tell allegro which mixer to use right there on the function. For example:

/* pseudocode */

al_attach_sample_instance_to_mixer(some_SFX_vector.ptr_instance, mixer_sfx);

///////////

How would I go about this for a stream? Would I have to call al_set_default_mixer() before loading a stream compatible file? E.g.

/* pseudocode */

al_set_default_mixer(mixer_bgm);
stream_bgm = al_load_audio_stream(some_file.c_str(), 2, 512);

///////////

Thank you for your time

Elias
Member #358
May 2000

Use al_attach_audio_stream_to_mixer, so:

al_attach_audio_stream_to_mixer(stream_bgm, mixer_bgm);

--
"Either help out or stop whining" - Evert

Restful Cargo
Member #16,106
October 2015

Thank you Elias

Go to: