1
我想在应用中预载一个* .wav文件,因为它比较大。我想要开始在viewcontroller1
中加载它,然后在viewcontroller15
中播放它。我需要代码来预加载它;播放代码如下:如何预先加载音频文件xcode
CFBundleRef mainbundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef =CFBundleCopyResourceURL(mainbundle, (CFStringRef) @"america", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
我创建了一个简单的iPhone应用程序,可以缓冲和播放大型音频文件。希望你可能会觉得这很有用。 https://github.com/iitotoro/BufferedAudioPlayer – Totoro 2013-02-08 07:07:47