View Full Version : Sound in OpenGL
11-13-2008, 07:44 AM
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 ;)
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.
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.
11-13-2008, 08:45 AM
SDL has OpenGL and audio support.
11-13-2008, 10:16 AM
Cool thank you very much!
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:
where they state in the tutorial the following:
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?
11-13-2008, 12:01 PM
suggestion : learn to use a search engine :)
11-13-2008, 12:40 PM
Good idea. Thank you very much :-)
11-13-2008, 12:45 PM
Ok well.. .since i am a complete n00b at OpenGL/OpenAL, i get this awful messeage:
what does it mean?
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);
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.
11-14-2008, 11:44 AM
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.
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.
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.