Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] How can I tell if a sample is currently playing?

Credits go to Edgar Reynaldo for helping out!
This thread is locked; no one can reply to it. rss feed Print
[A5] How can I tell if a sample is currently playing?
Neil Roy
Member #2,229
April 2002
avatar

Okay, I play a sample with the following example code...

al_play_sample(sfx_mysound, setting.sound_volume, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, NULL);

is there a simple way to check if it is currently playing?

I know in Allegro 4 I used to use voice_get_position() and I would check if it equaled -1 (wasn't currently playing) than I could play it again.

I'm looking at various Allegro 5.1 functions for voice, sample instances etc... and I am not quite sure what I need to do. Right now it's just a simple al_play_sample(), but I get the feeling I need to do a lot more so I can check to see if it is currently playing.

---
“I love you too.” - last words of Wanda Roy

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Neil Roy
Member #2,229
April 2002
avatar

Oops, asked this once before, I just couldn't find it until now, sorry. :/

---
“I love you too.” - last words of Wanda Roy

Go to: