Sign in to follow this  
Sean_A_Kelly

Loading Wave Files for OpenAL

Recommended Posts

Hi all, this is the first time I’ve posted on this forum. I am currently studying Computer Games Technology at University, and have been programming in C/C++ and OpenGL for the past year. Over the year I have been using GLUT and plenty of other extension libraries to cut coding corners. However before I go on my placement year, I am eradicating these libraries in favour of basic coding. So far I have replaced GLUT, the LoadBMP.lib and I am now replacing FMOD. Using OpenAL however means that I have to use ALUT to load in the .wav files, this I am trying to avoid. Googling has resulted in nothing but this Tutorial (that the guy didn't even bother to compile, if it was a tutorial why not?!?). However its proving difficult, I’ve fixed most of the syntax errors, however when I run the program all I get is a white screen and a huge memory leak (despite the fact I the free memory after its loaded into the buffer), please can anyone help! Tutorial "How to a Load Wave File" URL: http://www.gamedev.net/reference/articles/article709.asp My Code Snippet (I have only included this part of my sound class and none of the wave class): //Sound Loader bool sound::Load(char *Filename) { alGenBuffers(1, &Buffer); if (alGetError() != AL_NO_ERROR) return AL_FALSE; /*alutLoadWAVFile(Filename, &Format, &Data, &Size, &Freq, 0);*/ if (WAV->Load(Filename)) { alBufferData(Buffer,WAV->GetFormat(),WAV->GetData(),WAV->GetSize(), WAV->GetFreq()); } WAV->~wave; }

Share this post


Link to post
Share on other sites
Do you have really good reason to call deconstructor of wave object explicitly?

Share this post


Link to post
Share on other sites
I can't vouch for its quality or correctness, but it looks to be a spiffy (set of) tutorial(s): here.

And good luck with your studies. I'm sure you'll have a kickarse time in the game industy. [smile]

Share this post


Link to post
Share on other sites
VHL
Im not to sure what you mean by wave object explicitly (Although I probably should)?

HopeDagger
Those tutorials show me how to implement OpenAL, which I am ok with. However I dont want to be using the alut library to load in my Wave Data (Which even in the 'advanced loading' section of these tutorials, isnt covered).

Thanks anyway guys, but if anyone knows of a tutorial for loading wave files without any extensions that would be great.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sean_A_Kelly
VHL
Im not to sure what you mean by wave object explicitly (Although I probably should)?


At the end of your code snippet you call deconstructor of class wave explicitly: WAV->~wave;. You most probably shouldn't do that. For further reference, see C++ FAQ, Destructors.

Last time I had to deal with WAVE files, I used this site as a reference: WAVE File Format. Althought this article does not give you any premade code, it goes through every step that you need to know about WAVE files, in order to load them from file.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this