Sound playing question

Hey all,
I have an app where I want to play a sound, have it finish, then play the next sound. Right now if I put two sounds next to each other in the code, the second one is the only one I hear. Is there a way to have it finish the first sound before playing the second? I’m using the sound.Play function right now.

You could thread your sound play functions so that when the sound has completed it sets a flag to indicate it’s done and then moves on to the next sound. You’d have to implement a timer that would monitor the indicator to see when it was set to finished and then it would execute the next sound in your list, also in a thread. You could even make the sound file itself a parameter in the function you’re going to be executing with in the thread so that you could have have DRY code. Just an idea anyway…

if You know the length of sound1 ( seconds) you can do: Timer1.period = 5000 // here the length of sound 1 (sec * 1000) Timer1.Mode = 1

and in Timer1 Action: me.mode = 0


While Sound1.isPlaying

[quote=111566:@Roger Clary][code]

While Sound1.isPlaying
This will effectively lock up the whole application, though.

After, I’d kick a Timer off, which checks the .isPlaying property every second and when it becomes false, it plays the next sound.

…which will result in a possible gap of up to a second between sounds. The solution all depends on the needs of the OP. That’s why multiple answers are good and disparaging answers is not.

I was not disparaging your answer, I was merely point out that the operating system will very quickly consider the application as “not responding” if put into a while… wend loop as you suggested.

You could of course reduce the Timer to a fraction of a second, so that the second sound will kick in without a perceivable delay.

Oh, you guys…no disparaging answers detected here, just the same great help I usually find at this forum. Axel’s method worked quite well, it turned out. Thanks all!