openAL problems
Hi I've been struggling to get any output from my computer using OpenAL. Granted I have a dodgy 24 bit soundcard but I can't even get output through my internal speaker. This is my source:
I receive no error messages. Should i check for errors after i try to play the sound?
Thanks in advance
David
Code:
#define clickSound 1
{
alutInit(&argc, argv);
alListenerfv(AL_POSITION,listenerPos);
alListenerfv(AL_VELOCITY,listenerVel);
alListenerfv(AL_ORIENTATION,listenerOri);
alGetError(); // clear any error messages
// Generate buffers, or else no sound will happen!
alGenBuffers(NUM_BUFFERS, buffer);
if(alGetError() != AL_NO_ERROR)
{
printf("- Error creating buffers !!\n");
exit(1);
}
else
{
printf("init() - No errors yet.");
}
alutLoadWAVFile("sound/click.wav",&format,&data,&size,&freq);
alBufferData(buffer[clickSound],format,data,size,freq);
alutUnloadWAV(format,data,size,freq);
alGetError(); /* clear error */
alGenSources(NUM_SOURCES, source);
if(alGetError() != AL_NO_ERROR)
{
printf("- Error creating sources !!\n");
exit(2);
}
else
{
printf("init - no errors after alGenSources\n");
}
alSourcef(source[clickSound],AL_PITCH,1.0f);
alSourcef(source[clickSound],AL_GAIN,1.0f);
alSourcefv(source[clickSound],AL_POSITION,sourcePos);
alSourcefv(source[clickSound],AL_VELOCITY,sourceVel);
alSourcei(source[clickSound],AL_BUFFER,buffer[clickSound]);
alSourcei(source[clickSound],AL_LOOPING,AL_FALSE);
alSourcePlay(source[clickSound]);I receive no error messages. Should i check for errors after i try to play the sound?
Thanks in advance
David
My bet is that alutLoadWAVFile is failing, since you're not checking whether it's succeeded...

