Audio looping in Objective-C/iPhone
Posted
by Neurofluxation
on Stack Overflow
See other posts from Stack Overflow
or by Neurofluxation
Published on 2010-03-19T09:49:00Z
Indexed on
2010/03/19
9:51 UTC
Read the original article
Hit count: 460
So, I'm finishing up an iPhone App.
I have the following code in place to play the file:
while(![player isPlaying]) {
totalSoundDuration = soundDuration + 0.5; //Gives a half second break between sounds
sleep(totalSoundDuration); //Don't play next sound until the previous sound has finished
[player play]; //Play sound
NSLog(@" \n Sound Finished Playing \n"); //Output to console
}
For some reason, the sound plays once then the code loops and it outputs the following:
Sound Finished Playing
Sound Finished Playing
Sound Finished Playing
etc...
This just repeats forever, I don't suppose any of you lovely people can fathom what could be the boggle?
Cheers!
© Stack Overflow or respective owner