OpenAL usage in Code::Blocks on windows

Started by
6 comments, last by BennettSteele 12 years, 6 months ago
Ive now spent 2 days of precious work time trying to get OpenAL to work on code::blocks. I think i need a .lib, .dll, and .h for code::blocks to use when using OpenAL/OpenGL...
I just need a link, download, steps, something that will get to me using all of openAL in my game. i am using c++, and openGL on windows.
Advertisement
Have a look on my website here: http://www.marek-knows.com/downloads.php5?vmk=audioEng

I have a bunch of video tutorials that shows you exactly what you need. I download the OpenAL library, install it and run some tests to show how you would use it to playback audio.

My game Ghost Toast, integrates the audio manager developed in this video tutorial series and uses it in the game if you want to see how that works too.
Thank you so much!
Im going to try it. :P
If it does not help though... i will announce it. until then, yay! :D
So i got everything to link perfectly, i just am having problems playing it.
This is how i load the file:


ALuint nbuffer;
ALuint nsound;


alGenBuffers(1,&nbuffer);
alGenSources(1,&nsound);
nbuffer=alutCreateBufferFromFile("stuff/audio/sounds/door_open.wav");

if(!std::fstream("stuff/audio/sounds/door_open.wav")){exit(1);}
alSourcei(nsound,AL_BUFFER,nbuffer);


and this is how i play it:


case 'e':case 'E':
if(APP.Shift && Game.ChatShowTimer>=30){APP.Shift=false;Game.ChatShowTimer=0;}
else if(Game.ChatShowTimer>=30){APP.Shift=true;Game.ChatShowTimer=0;}
alSourcePlay(nsound);
break;



when i press E, it doesnt play the sound.
after you call alutCreateBufferFromFile you should check to see if you have any errors using alutGetError()

after each of your al calls (alGen*, alSourcei) you should call alGetError() to check for errors too
i just used right after loading:

if(!std::fstream("stuff/audio/sounds/door_open.wav") || alutGetError()!=ALUT_ERROR_NO_ERROR){exit(1);}

and it exits, does this mean there is a error in loading? i know for sure the std::ifstream is fine.
You can use alutGetErrorString(alutGetError()) to get the error message.

Are you calling alutInit anywhere?
DX sometimes i just feel stupid, i called my initializing function before alutInit();
well, at least i linked the librarys, that was my main problem. thank you a lot! :D
so yes, i solved the problem. :P

This topic is closed to new replies.

Advertisement