Sign in to follow this  
teslaa66

OpenAL Where to start?

Recommended Posts

Hi ive created a basic game in opengl and now wish to add sound or music so to start with i downloaded the openAL SDK, Alut and openAl installer and installed all three. Im using visual studios but have no idea what to do next? *** i have vista 64bit and a soundblaster audigy **** I have put openal.dll >>>>> windows/system32. openal32.dll >>>>> windows/system32. OpenAl32.lib >>>>>> vc98/lib. EFX-Util.lib >>>>>> vc98/lib al.h alc.h efx.h efx-creative.h EFX-Util.h xram.h >>>>>> vc98/include. I think thats all right. What do i need to add the simplest piece of sound in my game to test it works please?

Share this post


Link to post
Share on other sites
Here is a simple test program that might work for you.

#include <alut.h>
//
ALuint alBuffer;
ALuint source;
//
alutInit(0, NULL);
alBuffer = alutCreateBufferFromFile("wave_file_name.wav");
alGenSources(1, &source);
alSourcei(source, AL_BUFFER, alBuffer);
alSourcef(source, AL_GAIN, 1.0f);
alSourcef(source, AL_PITCH,1.0f);
alSourcei(source, AL_LOOPING, AL_FALSE);
//
alSourcePlay(source);
alSourceStop(source);

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