We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this q开发者_Go百科uestionis there an simple and lightweight C++ solution for playing music (aac, or mp3 or m4a) on the MAC OSX platform?
i found the SDL and OpenAL, but they are just to heavy for simple music playback
(the music is intended to be a background music for a game)
thank you
If you want just music playback and only for osx, I did a little mini-lib that uses the system provided routines to play. Available from here: https://github.com/scoopr/auplay
If you want to keep it portable and pure C++ OpenAL is the way to go.
If Mac only is ok then for those file formats it probably is easiest to use CoreAudio. There is an NSSound object which is simpler but it doesn't support those formats. Search for Playing Audio Files in your Xcode documentation to find info about how to play a file using core audio.
As far as I can tell, OpenAL and FMOD are the two major libraries exclusively used to play music (and audio in general). Stuff like SDL allows for playing audio, but it includes a variety of other things as well, and might be considered 'too heavy'. Both OpenAL and FMOD have been used in a variety of commercial games, and they're probably you're best option for this sort of thing, outside of writing your own library.
精彩评论