• 12 Jan 2009 /  Code No Comments

    Dear Lazyweb,

    When running in the foreground, my iPhone app occasionally uses an alert to get the user’s attention. If the Ring/Silent switch is set to silent mode, the phone will vibrate (kSystemSoundID_Vibrate); otherwise a sound is played.

    It appears as though the iPhone SDK limits me to playing audio supplied by my application only:

    Picture 3.png

    IMG_0001.PNGI was unable to find any explanation for this limitation of the AudioToolbox Framework on the google. Does anyone out there know what the justification might be? Note that Apple’s applications seem to be able to use system sounds (presumably using the same AudioServicesPlaySystemSound or AudioServicesPlayAlertSound API calls exposed to us), as shown in this screenshot of the Alarm Clock application.

    Update:

    It looks like I’m able to use an NSDirectoryEnumerator to get the contents of /Library/Ringtones/ on the phone, but if I try to load one of these files using AudioServicesCreateSystemSoundID() it fails with OSErr -1500 (Operation could not be completed). Sandboxing… Thanks to Steve Makofsky for his help.

    Posted by Jake @ 1:50 am

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.