我使用的Xcode 4.2 我创建了一个功能,如下所示sequentialy播放声音剪辑的数组:我使用AudioServicesPlaySystemSound函数里面,我可以通过SystemSoundID变回调用程序
// - ------------------------------ // FUNCTION TO recite quad game messages // -------- ----------------------- void SayQuad(int pageNumber,NSMutableArray quadSounds []) NSString * fileName = [quadSounds objectAtIndex:pageNumber]; NSString * path = [[NSBundle mainBundle] pathForResource:fileName ofType:@“wav”]; SystemSoundID sayIt; ; NSURL * filePath = [NSURL fileURLWithPath:path isDirectory:NO]; AudioServicesCreateSystemSoundID((CFURLRef)filePath,& sayIt); AudioServicesPlaySystemSound(sayIt);
} 现在基于用户操作,我想在声音剪辑结束之前取消声音剪辑。这可以通过以下方式完成: AudioServicesDisposeSystemSoundID(sayIt); 但是,变量“sayIt”需要传递回调用程序。 我是新来的,根本不知道该怎么做。 我曾尝试设置指针变量,但甚至无法让它们编译。
任何帮助将不胜感激。