views:

388

answers:

2

Hi, I am developing a simple iPhone sound app. How can I play 1 sound clip after another without any interruption ?

A: 

Hello,

You could have an array with all your filnenames you have to play. The goal is to begin playing next song when current song is almost at the end of the file (maybe 0.5 seconds from the end).

You need a thread controller which manage what should be playing. He knows what it is playing and what should be played next.

Playing thread may send a message when the end is near, your controller then allocate a new player thread and begin playing, and so on...

Hope this help.

Thierry

thierryb
plz send me details with code.
Nahid
+3  A: 

Are you using SystemSounds or AudioQueues? If SystemSounds (for short sounds), you'll need to have a thread that plays them at a specific time interval, as there is no way to know when the sound ends.

For AudioQueues, you get callbacks when each section of a sound is finished, and so it's a fairly easy thing to start another sound (say, background music) when the first ends.

You don't really state what you're trying to accomplish, so giving a specific answer is difficult. Are you looking to splice together sound files? Play background music? Make 3 lazer-beam sounds come when the user shoots 3 times? Etc.

Olie