views:

82

answers:

1

Hi All,

In my application, I am displaying multiple images in rows and columns when i click on a image i will play corresponding sound using

someName = [someName stringByAppendingFormat:@".mp3"];
[audioPlayer stop];

NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%s", [[NSBundle mainBundle] resourcePath],[someName UTF8String]]];

NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
audioPlayer.delegate = self; 

When i am clicking on the one image i will get particular image sound. When i click on the another image the previous sound will be stopped and new sound corresponding the image will be played.

My requirement is when i click on the first image the sound must come and when i click on the second image the first sound must not stop and both must play and when i click on the third one the three sounds must play.

Please help me out

A: 

Below is the url which can help you. But you can't play 2 mp3 files simultaneously, and if you wanted to play more than 1 file at a time, you should use wav files.

http://www.blumtnwerx.com/blog/2009/06/playing-audio-on-the-iphone/
itsaboutcode