我使用的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」需要傳遞迴調用程序。 我是新來的,根本不知道該怎麼做。 我曾嘗試設置指針變量,但甚至無法讓它們編譯。
任何幫助將不勝感激。