PDA

View Full Version : how can I detect when a sound finished playing?


bernie
05-10-2007, 09:37 AM
Hi there,
I looked through all the docu of vizard and the forum, but I couldn't find any info on how to detect when a sound file stopped playing.
For an experiment, I'd like to have several sound files play one after each other, and also record how long the playing took.
Any help is appreciated, I'm still new to Vizard :o

farshizzo
05-10-2007, 10:35 AM
Hi,

Are you using Vizard 2.5 or 3.0? Also, please post Vizard related questions in the appropriate forum in the future.

bernie
05-10-2007, 12:58 PM
Sorry for posting accidentally in the wrong list, won't happen again.
I'm using Vizard 3.00.1903.

farshizzo
05-10-2007, 06:08 PM
Hi,

In Vizard 3.0 you can query the state of an audio object. So you can create a timer that checks the state and performs some code when the audio stops. Here is sample code to check the state of an audio object:a = viz.add('myaudio.mp3')
.
.
.
state = a.getState()
if state == viz.MEDIA_STOPPED:
print 'Audio is stopped'