- Online Community Forums » Programming Questions » play two consecutive sounds?

Credits go to MikiZX for helping out!
This thread is locked; no one can reply to it. rss feed Print
play two consecutive sounds?
Member #17,112
August 2019

Hi guys, I'm new here.
I thank you for allowing me to enter.

Today as my first publication I come with a little doubt of a code that I am trying to create with the reproduction of wavs files.

My question is this:
When I make a sound play, how can I tell the program to rebise that this first sound finishes playing to play a second sound?
because the sounds always play at the same time.

I forgot to tell you that I use allegro version 4.2.3 with visual c ++, the code for version five was very complicated for me.

that is all,
From already thank you very much,


Edgar Reynaldo
Major Reynaldo
May 2007

Member #17,112
August 2019

OK, thank you very much for responding.
I was looking at those two commands, but I don't understand how they are written.
From what I understand it is not that it serves to have an audio in a channel but not to play it?
and to use this,
I wouldn't have to use load_sample so that I know what audio it is?

could you please give me a small example of how it is used?
I have always used the play_sound command, and I thought that with the identifier that was returned it could be done, but I did not get it.

Member #17,092
June 2019

Possibly this can help you:

I don't use Allegro4 so not really my place to be posting here but you can always check the documentation - that is how I found the above link.

Also, the documentation is what makes me say the following (so please take it with a grain of salt):
'allocate_voice' and 'play_sample' both return a voice number (think of the voice number as an identifier of an available sample playback slot in the audio mixer - there can be many voices(slots) available). If you are using 'allocate_voice' then you would start the playback of that voice using 'voice_start' function.
Use the 'voice_get_position' (for more control) or just 'voice_check' to have some information regarding the audio playback of your sample.

Again, I don't use Allegro 4 so this post is done just in hope it can help you figure out the system on your own.

Member #17,112
August 2019

Fantastic companion, I have succeeded.
Thank you very much for answering, it was very helpful.
It wasn't as complicated as I imagined, spending a little time it worked.

thanks again,

Go to: