Jump to content
  • Advertisement
Sign in to follow this  
yahn

openAL WAV loading

This topic is 4160 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can anyone tell me how to load a WAV file without using alutLoadWAVFile? I'm asking because ALut is saying that alutLoadWAVFile is depreciated. Also, when I use it I get warnings and I can't get the sound to play back either. Every time I search for "openAL WAV" I get a result using alutLoadWAVFile. So, can anyone help me out?

Share this post


Link to post
Share on other sites
Advertisement
Hi

I didn't know it was depricated, where did you get that info from ? I have no idea actually what to use instead. I can only recommend using ogg vorbis, but then you have do the streaming, which is fairly hard to get right.

Share this post


Link to post
Share on other sites
Pretty easy. Open up the wave file, read the riff information, deocde it to a buffer, and give that buffer to OpenAL. If you want, you can take a look at my wave loading code in my wip game engine:
https://www.wreckedgames.com/svn/wge/trunk/src/Codecs/WavCodec.cpp

You can download the whole source by going to:
https://www.wreckedgames.com/svn/wge/trunk/

Feel free to use the wave loading stuff, even though my code is GPL, I don't have a problem with you borrowing something so trivial. The code there uses an abstraction layer to pass the decoded audio to any sound library (namely OpenAL & Fmod in my code). You can look at the OpenAL plugin in my code base to see how the sound is put to a OpenAL source.

Hope that helps. Note: I used the raw wave loader since I didn't want to use Alut (just like you). It handles basic wave files using either 16 or 8 bit audio / mono/multi channel audio.

Edit - clickified links!

Share this post


Link to post
Share on other sites
Is there a reason why I can't play the sound after I call glutMainLoop()? It works before I call that, but after I call glutMainLoop() I hear nothing.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Avoid Glut, it's not really maintained anymore. Just learn and use an OS and OpenGL.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
RTFM:
http://www.openal.org/openal_webstf/specs/alut.html#alutCreateBufferFromFile

Share this post


Link to post
Share on other sites
RAZORUNREAL thanks for the suggestions, but I really don't want to completely change my project. GLFW may work, but unless I know what the problem is, I don't know how I'm going to fix it. Can anyone tell me why a sound can't be played once glutMainLoop() is entered? And how could GLFW change that? I know there have been games that use glut and alut that play sounds. So, there must be a way to work around this.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!