PDA

View Full Version : Sound in OpenGL



dvwood
11-13-2008, 07:44 AM
Hi all,

I basically need to load a sound into a project, just like a background sound, nothing too fancy, but dont know where to start. My project contains a room build around 5 simple quads, and i basically want to add a sound, like the sound of being inside of a spaceship (in space).
I googled for a tutorial but couldnt find anything, only the OpenAL thing, which looks really complicated. Isnt there any easy code for copy/pasting for loading a sound file.... just like simple html hehe ;)

_NK47
11-13-2008, 07:56 AM
no there isn't. any sound has nothing to do with a graphics API. stick to OpenAL. topic is totally opengl unrelated.

trinitrotoluene
11-13-2008, 07:59 AM
Look at this OpenAL tutorial (http://www.devmaster.net/articles/openal-tutorials/lesson1.php) at DevMaster web site.This should help you.

_NK47
11-13-2008, 08:45 AM
SDL has OpenGL and audio support.

dvwood
11-13-2008, 10:16 AM
Cool thank you very much!

dvwood
11-13-2008, 11:55 AM
So i have a small problem, because i am developing in Xcode on my Mac. The only 2 files included in the OpenAL framework are the following:
#include <OpenAL/al.h>
#include <OpenAL/alc.h>

where they state in the tutorial the following:
#include <conio.h>
#include <stdlib.h>
#include <al/al.h>
#include <al/alc.h>
#include <al/alu.h>
#include <al/alut.h>

they are using for instance the alutLoadWAVFile() function which i dont have the prototype for, because i dont have the alut.h library..... any suggestions to what i can do?

ZbuffeR
11-13-2008, 12:01 PM
suggestion : learn to use a search engine :)
http://developer.apple.com/qa/qa2006/qa1504.html

dvwood
11-13-2008, 12:40 PM
Good idea. Thank you very much :-)

dvwood
11-13-2008, 12:45 PM
Ok well.. .since i am a complete n00b at OpenGL/OpenAL, i get this awful messeage:

http://i45.photobucket.com/albums/f88/cadaverman/deprecated.jpg

what does it mean?

dvwood
11-13-2008, 12:46 PM
oh, and there are absolutely no errors at line 110 in the alut.h file as my compiler indicates.
i just have this line of code:

ALUT_API ALUT_ATTRIBUTE_DEPRECATED void ALUT_APIENTRY alutLoadWAVFile (ALbyte *fileName, ALenum *format, void **data, ALsizei *size, ALsizei *frequency);

ZbuffeR
11-13-2008, 12:52 PM
ALUT_ATTRIBUTE_DEPRECATED : and you wonder why you have a deprecation warning ?

Normally 'deprecated' means you should not rely on it in a future version. But it will work now.

According to the link I posted above, it would be better to use freealut instead of alut.

noeska
11-14-2008, 11:44 AM
http://en.wikipedia.org/wiki/Deprecated

So better not use those functions and write your own. I think that goes for all alut functions. Better load the wav into a buffer and feed that to openal instead.

But opengl can be used for audioprocessing also. I believe in the ati sdk is an example on that.

dletozeun
11-15-2008, 04:21 AM
I have never used OpenAL, but generally, 'deprecated' means that the function you are using should not be used. You should instead do it in the recommended way told by the OpenAL specification.
This function is still available to support old programs that already use OpenAL.

James A.
11-15-2008, 06:14 AM
fmod is also available for free providing your are not making a commercial product. http://www.fmod.org/

I don't know how it compared to OpenAL as I have never used OpenAL. However I found Fmod very quick and easy to set-up in my project.