0

AVAudioPlayer を動作させることができません。ただし、AudioServices を問題なく動作させることはできます。私の質問は、なぜ一方が機能し、もう一方が機能しないのですか?? 違いはなんですか?それでも問題が解決しない場合、次の質問は、AudioServices でループして速度を変更できるかどうかです。これが私の究極の目標です。ありがとう!

// this works
SystemSoundID soundID;
NSString *soundFile = [[NSBundle mainBundle]
                      pathForResource:@"explode" ofType:@"wav"];
AudioServicesCreateSystemSoundID((__bridge  CFURLRef)
                                 [NSURL fileURLWithPath:soundFile], & soundID);
AudioServicesPlaySystemSound(soundID);


// this does not
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
                                 pathForResource:@"explode" ofType:@"wav"]];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
[audioPlayer play];
4

0 に答える 0