|
[Audio] How to play a sound n times in A5? |
xpolife
Member #12,487
January 2011
|
How to play a sample and/or an audio stream n times in A5? possible solution are: the 1 solution seems not supported in A5 now. My question is: |
someone972
Member #7,719
August 2006
|
Create sample instances and use the functions associated with sample instances to play it. You can then use al_get_sample_instance_playing(...) to check if it's still playing. Manual page for your convenience: Audio Routines (Scroll down a bit for sample instance functions) ______________________________________ |
xpolife
Member #12,487
January 2011
|
Thanks for replying. And I think the al_get_sample_instance_playing() is a polling manner, I'd prefer the event notify manner if possible. |
someone972
Member #7,719
August 2006
|
I haven't seen anything that outputs an event when a sample stops, but I haven't really been playing sounds so I can't be sure. If you really want an event you could create a user event and send that, but you would still need to poll the sample. ______________________________________ |
jmasterx
Member #11,410
October 2009
|
For streams I know there is: Quote: If the stream is created by al_load_audio_stream then it can also generate an ALLEGRO_EVENT_AUDIO_STREAM_FINISHED event if it reaches the end of the file and is not set to loop.
Agui GUI API -> https://github.com/jmasterx/Agui |
|