0
왜 내 음악이 겹 칩니 까? 하나씩 재생할 수있는 방법이 있습니까? .H에서소리가 겹침
- (void)viewDidLoad
{
[super viewDidLoad];
NSMutableArray *array = [NSMutableArray array];
[array insertObject: [[NSBundle mainBundle] pathForResource:@"Master of Puppets" ofType:@"mp3"] atIndex:0];
[array insertObject: [[NSBundle mainBundle] pathForResource:@"music" ofType:@"mp3"] atIndex:1];
[array insertObject: [[NSBundle mainBundle] pathForResource:@"Start" ofType:@"caf"] atIndex:2];
[array insertObject: [[NSBundle mainBundle] pathForResource:@"thx" ofType:@"m4v"] atIndex:3];
[array insertObject: [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"aif"] atIndex:4];
for (int i=0; i < [array count]; i++)
{
theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[array objectAtIndex:i]] error:NULL];
theAudio.delegate = self;
[theAudio prepareToPlay];
[theAudio play];
}
}
:
@interface STAMP_AudioViewController : UIViewController <AVAudioPlayerDelegate>{
AVAudioPlayer* theAudio;
}
@end