当用户单击按钮时,我正在使用AVAudioPlayer播放小声音。声音持续约3秒钟,我想要的是,如果用户多次按下按钮,该声音应该会多次发声。如果用户在2秒内点击两次,则第二个声音应该与第一个镜头重叠。在iOS中播放重叠声音
我的问题是,镜头只发出每3秒钟(如果用户快速点击),而不是每按一次按钮。
里面viewDidLoad中
NSString *path = [[NSBundle mainBundle] pathForResource:@"shot" ofType:@"caf"];
urlShotCaf = [NSURL fileURLWithPath:path];
player = [[AVAudioPlayer alloc] initWithContentsOfURL:urlShotCaf error:nil] ;
[player prepareToPlay];
而当一个人点击了发射按钮
- (IBAction)tap:(id)sender {
clicks++;
[player play];
}
我能做到这一点与AVAudioPlayer?我应该使用另一个框架吗?