views:

94

answers:

3

Hi,

I am porting an iPhone app to Mac. On iPhone I use AVAudioPlayer for playing sounds, but it doesn't exist on Mac. What would be the Mac equivalent for playing audio (hopefully as simple as AVAudioPlayer so I can port my app easily)?

Additionally, are there any open source libraries / samples / wrappers available for playing music and sound files on Mac?

A: 

Take a look at Core Audio:

Core Audio is designed to handle all audio needs in Mac OS X. You can use Core Audio to generate, record, mix, edit, process, and play audio.

Alex Reynolds
Core Audio also exists on the iPhone. It's the low-level counterpart to AVAudioPlayer on iOS and NSSound on Mac OS X.
Peter Hosey
+2  A: 

Depending on what capabilities you need, Core Audio might be unnecessarily complex. The obvious simple way is NSSound. It's also possible to use a hidden QTMovieView to play sound.

JWWalker
I am using AudioQueues.
Chandan Shetty SP
+1  A: 

I've written a framework for audio playback, called SFBAudioEngine: http://github.com/sbooth/SFBAudioEngine

It might be a bit more than you're looking for, but it is more capable than NSSound and supports formats (FLAC, Musepack, Ogg Vorbis) that Core Audio doesn't handle natively.

sbooth