Hello-
I'm using AVAudioPlayer to play sounds (SDK 2.2.1). Below if the code I'm using that's in a method that is called when I touch the screen. I stop any sounds that's already playing to play a new one if the touch occurs while another sounds is already playing.
The problem is that every 3-5 times that I start a sound, the sound completes and then starts looping the last little bit of the sound. It sounds like a cd skipping. I've spent 3 hours trying different things, and Googling brings up nothing. Any ideas? Thanks in advance!
I'm using AVAudioPlayer to play sounds (SDK 2.2.1). Below if the code I'm using that's in a method that is called when I touch the screen. I stop any sounds that's already playing to play a new one if the touch occurs while another sounds is already playing.
The problem is that every 3-5 times that I start a sound, the sound completes and then starts looping the last little bit of the sound. It sounds like a cd skipping. I've spent 3 hours trying different things, and Googling brings up nothing. Any ideas? Thanks in advance!
Code:
int soundNum = arc4random() % [soundsArray count];
AVAudioPlayer *sound = [soundsArray objectAtIndex:soundNum];
[currentSound stop];
currentSound = nil;
currentSound = sound;
[currentSound setCurrentTime:0.0];
[currentSound play];