Can we play 2 mp3 sounds on the same time on the iphone?Does iphone support this feature?
Yes, but it's annoying as s*** (for the user).
(sort of(Pseudo-Code)) (I'm too lazy to look up the method names/libraries)
-(void)playSounds{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
[self playSound1];
[self playSound2];
[pool release];
}
-(void)playSound1{
NSString *path = [[NSBundle mainBundle] pathForResource:@"file1"
ofType:@"m4a"];
AVAudioPlayer* player= [[AVAudioPlayer alloc] initWithContentsOfURL:
[NSURL fileURLWithPath:path]
error:NULL];
player.delegate = self;
[player play];
}
-(void)playSound2{
SString *path = [[NSBundle mainBundle] pathForResource:@"file2"
ofType:@"m4a"];
AVAudioPlayer* player= [[AVAudioPlayer alloc] initWithContentsOfURL:
[NSURL fileURLWithPath:path]
error:NULL];
player.delegate = self;
[player play];
}
Note that this is really quick and dirty. If you want precision, you'll probably have to notify when the players are ready and write a function that fires them at once.