Sign in to follow this  
BennettSteele

OpenAL usage in Code::Blocks on windows

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Have a look on my website here: [url="http://www.marek-knows.com/downloads.php5?vmk=audioEng"]http://www.marek-knows.com/downloads.php5?vmk=audioEng[/url]

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.

Share this post


Link to post
Share on other sites
So i got everything to link perfectly, i just am having problems playing it.
This is how i load the file:

[code]
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);
[/code]

and this is how i play it:

[code]
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;
[/code]


when i press E, it doesnt play the sound.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

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