Friday, September 13, 2013 [Tweets] [Favorites]

Playing Sound Effects the Right Way

Paul Kafasis:

Unfortunately, many applications do not currently play their sound effects properly, ignoring the user’s Sound Effects output selection. The end result for users is that audio snippets which are in fact sound effects incorrectly play through the main audio output. Luckily, fixing the problem is quite simple. Below, we show example code for playing back audio with Cocoa’s NSSound, on the system alert device.

Their code sets the device playback identifier on an NSSound, which you can then play in the normal way. I found that this correctly plays the sound on the right device, but it does not respect the “Alert volume” in System Preferences. For SpamSieve, I have been using the AudioServicesPlayAlertSound() API, which uses both the alert device and the alert volume.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment