Digital Media Mac Blogs > Mac

Non-interrupting audio alerts


As anyone who has worked on the iPhone knows, issuing a sound alert comes with a price. If you use the standard QuickTime-esque Celestial audio controller to play your sounds, you'll stop any ongoing iPod or Video playback at once.

This past weekend, I spent time rummaging through the marvelous GraphicsServices framework and found this wee gem: GSEventPlaySoundAtPath.

When called with one argument, an NSString, the GraphicsServices call will play back that sound but not interrupt normal playback. So you can have your beep and your iPod too.

Unlike Celestial audio, there is no way to catch the end of the playback and the call runs in parallel. So keep you sounds short and if you need to wait for them to finish, use an NSTimer or an NSObject delay to pick up after the sound plays back.

Categories





AddThis Social Bookmark Button
Comments (0)
Read More Entries by Erica Sadun.

Leave a comment


Recommended for You

Topics of Interest

Archives


 
 


Or, visit our complete archive.