Recipe: Simple Audio Alerts
Audio alerts “speak” directly to your users. They produce instant feedback—for users who are not hearing impaired. Fortunately, Apple built basic sound playback into the Cocoa Touch SDK through System Audio services.
The alternatives include using Audio Queue calls or AVAudioPlayer. Audio Queue playback is time-consuming to program and involves much more complexity than simple alert sounds need. In contrast, you can load and play system audio with just a few lines of code. AVAudioPlayer also has drawbacks. It interferes with iPod audio. In contrast, System Audio can perform a sound without interrupting any music that’s currently playing, although that may admittedly not be the result you’re looking for, as alerts ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access