Additional Information on Playing Sounds
Besides the callback parameter that was demonstrated in Example 24,you can specify how many times the sound should be played. For instance,
if you specify play(times = 20), the sound will play 20 times. If you
want to repeat the same sound forever, use play(audio.KMdaRepeat
Forever). If you want to leave some silence between subsequent plays,
use the interval parameter to specify the interval in microseconds.
Some phones do not support simultaneous playing of audio files. If
you try to call the play() function in such a phone while a sound is
playing, an exception is raised. You can prevent this from happening by
always calling stop() before playing a sound. Also note that you have
to call stop() explicitly before your script exits or the sound will keep
playing in the background even after your program has ended.
No comments:
Post a Comment