Waiting while sound is playing
Posted: Tue Mar 08, 2011 5:01 pm
Hi there,
I'm writing a program that plays an audioclip, then waits for 2 seconds, then plays another audioclip, waits another 2 seconds, then plays a final audioclip. The audioclips themselves vary from 1.5 to around 3ish seconds. However, at the moment the code looks something like this:
play audioclip clip1.wav
wait 2 seconds
play audioclip clip2.wav
wait 2 seconds
play audioclip clip3.wav
The problem is that the wait functions execute from the beginning of the audioclip, rather than waiting till the audioclip is finished. So at best the audioclips play end to end, and sometimes a clip is stopped so a new one can start. How can I do what I actually want to do? I have a feeling the playstopped message comes into it somewhere but my understanding of the code isn't good enough yet to figure out how!
Any help would be greatly appreciated.
I'm writing a program that plays an audioclip, then waits for 2 seconds, then plays another audioclip, waits another 2 seconds, then plays a final audioclip. The audioclips themselves vary from 1.5 to around 3ish seconds. However, at the moment the code looks something like this:
play audioclip clip1.wav
wait 2 seconds
play audioclip clip2.wav
wait 2 seconds
play audioclip clip3.wav
The problem is that the wait functions execute from the beginning of the audioclip, rather than waiting till the audioclip is finished. So at best the audioclips play end to end, and sometimes a clip is stopped so a new one can start. How can I do what I actually want to do? I have a feeling the playstopped message comes into it somewhere but my understanding of the code isn't good enough yet to figure out how!
Any help would be greatly appreciated.