Objective c 我可以使用音频工具箱播放循环吗?

Objective c 我可以使用音频工具箱播放循环吗?,objective-c,ios,avaudioplayer,audiotoolbox,Objective C,Ios,Avaudioplayer,Audiotoolbox,在我的应用程序中,我使用AudioToolbox框架,我需要播放循环,可以吗 这是AVAudioplayer代码,同时进行2次触摸,速度很慢 - (AVAudioPlayer *)getNoteFromFilename:(NSString *)name andoftype:(NSString *)type{ NSString *soundPath = [[NSBundle mainBundle] pathForResource:name

在我的应用程序中,我使用AudioToolbox框架,我需要播放循环,可以吗

这是AVAudioplayer代码,同时进行2次触摸,速度很慢

- (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;

}
在视图中加载

ViewDidLoad {

    self.Note = [self getNoteFromFilename:@"Note" andoftype:@"wav"];


}
在iAction中通过此调用它:

[Note prepareToPlay];
[Note play];

注意:我已重新绑定了所有按钮,而AVAudioPlayer将改用。在那里,您可以使用
numberOfLoops
属性轻松循环。

您好,如果我想使用AVAudioPLayer,我将失去音量控制,因为audiotoolbox加载的所有声音都将被修复,不会增加或减少音量。这里有一个
[AVAudioPLayer音量]
属性,这解决了你的问题吗?AVAudioPlayer没有问题,但是从包含AudioServicesPlaySystemSoundAha的函数调用的声音有问题,明白了。使用AVAudioPlayer播放所有声音如何?我注意到,如果所有声音都使用AVAudioPlayer,则与用户的交互速度会很慢,即AudioToolbox比AVfoundaion好得多,特别是当您同时播放两个声音时