私のアプリでは AudioToolbox フレームワークを使用していますが、ループを再生する必要がありますか?
これは、同時に 2 つのタッチでゆっくり進む AVAudioplayer コードです。
- (AVAudioPlayer *)getNoteFromFilename:(NSString *)name andoftype:(NSString *)type{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:name
ofType:type];
NSURL *fileURL = [NSURL fileURLWithPath:soundPath];
AVAudioPlayer *note = [[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL
error:nil] autorelease];
return note;
}
ビューでdidload
ViewDidLoad {
self.Note = [self getNoteFromFilename:@"Note" andoftype:@"wav"];
}
IBAction でこれを呼び出す:
[Note prepareToPlay];
[Note play];
注意: すべてのボタンと AVAudioPlayer を保持しています