#include <AudioToolbox/AudioToolbox.h> #include <CoreFoundation/CoreFoundation.h> // Define a callback to be called when the sound is finished // playing. Useful when you need to free memory after playing. static void MyCompletionCallback ( SystemSoundID mySSID, void * myURLRef ) { AudioServicesDisposeSystemSoundID (mySSID); CFRelease (myURLRef); CFRunLoopStop (CFRunLoopGetCurrent()); } int main (int argc, const char * argv[]) { // Set up the pieces needed to play a sound. SystemSoundID mySSID; CFURLRef myURLRef; myURLRef = CFURLCreateWithFileSystemPath ( kCFAllocatorDefault, CFSTR ("../../ComedyHorns.aif"), kCFURLPOSIXPathStyle, FALSE ); // create a system sound ID to represent the sound file OSStatus error = AudioServicesCreateSystemSoundID (myURLRef, &mySSID); // Register the sound completion callback. // Again, useful when you need to free memory after playing. AudioServicesAddSystemSoundCompletion ( mySSID, NULL, NULL, MyCompletionCallback, (void *) myURLRef ); // Play the sound file. AudioServicesPlaySystemSound (mySSID); // Invoke a run loop on the current thread to keep the application // running long enough for the sound to play; the sound completion // callback later stops this run loop. CFRunLoopRun (); return 0; }
南来地,北往的,上班的,下岗的,走过路过不要错过!
======================个性签名=====================
之前认为Apple 的iOS 设计的要比 Android 稳定,我错了吗?
下载的许多客户端程序/游戏程序,经常会Crash,是程序写的不好(内存泄漏?刚启动也会吗?)还是iOS本身的不稳定!!!
如果在Android手机中可以简单联接到ddms,就可以查看系统log,很容易看到程序为什么出错,在iPhone中如何得知呢?试试Organizer吧,分析一下Device logs,也许有用.