tags:

views:

9

answers:

0

HI all, i am using this code to play AVAudio player What i am actually trying to do is, when i finsieh animation, i get a count value and play audio player with the count value which should match to SOundList array from pList.

like if count =1 than array int i = 1 ======="play track 1" count =2 than array int i = 1 ======="play track 2"

"
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{ NSLog(@"Animation Finished"); NSLog(@"cound in touch : %d" ,count);

NSString *soundsPath = [[NSBundle mainBundle] pathForResource:@"soundslist" ofType:@"plist"];
soundsList = [[NSArray alloc] initWithContentsOfFile:soundsPath];


i = 0;

for (i; i <= ([soundsList count] - 1); i++) {

    NSLog(@"soundsList contains %@", [soundsList objectAtIndex:i]);

}   

 filename = [soundsList objectAtIndex:i];
path = [[NSBundle mainBundle] pathForResource:filename ofType:@"mp3"];  

//
newAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
self.audioPlayer = newAudio; // automatically retain audio and dealloc old file if new file is loaded

[newAudio release]; // release the audio safely

audioPlayer.delegate = self; 
[audioPlayer prepareToPlay];
[audioPlayer setNumberOfLoops:0];
[audioPlayer play];



[appDelegate.window setUserInteractionEnabled:TRUE];

} "

but i am getting this "CoreAnimation: ignoring exception: -[__NSCFArray objectAtIndex:]: index (6) beyond bounds (6) "

sory for unformated question.. suggestions plz. regards