OpenAL - loading and playing mp3

Nibbie
Posts: 4
Joined: 2008.06
Post: #1
Hi all,

looking at moving my old Sound Manager code over to OpenAL. I currently have a lot of my sound samples in mp3 format.

Is there an easy way to load these sounds such that OpenAL can readily use them? A utility function or framework perhaps? I'm not really looking to reinvent the wheel here or go in to the fine details (and pain) of sound data conversion, so anything that could save me some time would be greatly appreciated.

thanks.
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2008.06
Post: #2
Further to this...

I'm working through the OpenALExample Xcode project that ships with the Leopard Dev SDK. That sample code uses OpenALUtility (alut) code, to handle .wav loading, yet it does not appear to be calling alutInit() before hand.

If I include alutInit(), I receive sound-buffer loading errors at runtime. Is the OS calling this function behind the scenes? (I don't mind if it is, but would like to know.)

Also, doing a "Go to Definition" on either alutInit() or alutUnloadWAV() will not produce a result. How is the project even compiling is there is (seemingly) no header definition for alutUnloadWAV()??

thanks for any and all help
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
There is no definition because the ALUT functions are in a framework. "go to declaration" should work fine.

alutInit() is not called automatically, but I don't think it does anything that can't be done by alc routines, which the project may be using manually. If you care to find out, the source is available on openal.org
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2008.06
Post: #4
Thanks for the response.

If I select an ALUT function in my source -- say, alutInit() -- the pop-up menu does not have any "go to declaration" command for it. Only a "jump to definition", which doesn't do anything.

Attempting to find the definition in the documentation or API reference shows no results.

If I search textually in all project files, including the frameworks, the only reference to alutInit is in my .m source file!

How very odd. How on earth is this thing compiling and linking?

(Non-iPhone OS 10.5.3)
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
Clearly you don't have your warnings set high enough for the compiler to yell about calls to functions with no prototype. It's legal C, it's just not guaranteed to behave correctly.

alut is deprecated as of OpenAL 1.1, and was removed from the headers at that time (10.4.7 or so).
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2008.06
Post: #6
FWIW, I'm using default settings. It's Xcode out of the box, using Apple's sample code.

If alut is deprecated from the headers, what are people doing to feed sound data to this thing?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
Default settings are useless. Add "-Wall -Wextra -Wno-unused-parameter -Wnewline-eof -Werror" to "extra warning flags" for the compiler to be more useful.

I've always used ogg/vorbis to feed to AL. It's pretty easy.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenAL Playing a note jlebrech 6 6,923 Feb 12, 2010 04:45 PM
Last Post: Frank C.
  OpenAL, aiff / wav loading reubert 3 4,959 Feb 22, 2008 08:19 AM
Last Post: ThemsAllTook