Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Sound

This thread is locked; no one can reply to it. rss feed Print
Sound
Vieira
Member #16,926
December 2018

Hi, ;D
I have the idea of ​​making a menu where I can manually adjust the sound, for example, control the gain of the background sound, or even the sound effects of the game, but I got confused and I think I do not know how to do ...

This is how I defined the sounds

#SelectExpand
1 2ALLEGRO_SAMPLE *trilha_sonora= NULL; 3 4ALLEGRO_SAMPLE_INSTANCE *inst_trilha_sonora=NULL; 5 6 trilha_sonora = al_load_sample("trilha_sonora.ogg"); 7 inst_trilha_sonora= al_create_sample_instance(trilha_sonora); 8 al_attach_sample_instance_to_mixer(inst_trilha_sonora, al_get_default_mixer()); 9 al_set_sample_instance_playmode(inst_trilha_sonora,ALLEGRO_PLAYMODE_LOOP); 10 al_set_sample_instance_gain(inst_trilha_sonora,0.7); 11 12 al_play_sample_instance(inst_trilha_sonora);

Go to: