Sign in to follow this  
Outcast Orange

OpenAL alBufferData Error 40961

Recommended Posts

The specific error code is 40961
The comments on the left should give you all the information you need:

[code]
alutInit(NULL,0);
alGetError();
ALuint buffers[AL_NUM_BUFFERS];
alGenBuffers(AL_NUM_BUFFERS, buffers);
if ((AL_ERROR = alGetError()) != AL_NO_ERROR)
{
printf("alGenBuffers : %d", AL_ERROR);
return 0;
}
ALfloat SourcePos[] = {0.0,0.0,0.0};
ALfloat SourceVel[] = {0.0,0.0,0.0};
ALfloat SourceOri[] = {0.0,0.0,0.0};
ALfloat ListenerPos[] = {0.0,0.0,0.0};
ALfloat ListenerVel[] = {0.0,0.0,0.0};
ALfloat ListenerOri[] = {0.0,0.0,-1.0,0.0,1.0,0.0};
ALenum format;
ALvoid* data;
ALsizei size;
ALsizei freq;
ALboolean loop;
alutLoadWAVFile("Sound Effects/click2.wav", &format, &data, &size, &freq, &loop);
if ((AL_ERROR = alGetError()) != AL_NO_ERROR)
{
printf("alutLoadWAVFile Sound Effects/click2.wav : %d", AL_ERROR);
alDeleteBuffers(AL_NUM_BUFFERS, buffers);
return 0;
}
alBufferData(Buffers[0], format, data, size, freq); //Problem seems to become apparent here
if ((AL_ERROR = alGetError()) != AL_NO_ERROR)
{
printf("alBufferData buffer 0 : %d", AL_ERROR); //I'm getting this line as output
alDeleteBuffers(AL_NUM_BUFFERS, buffers);
return 0;
}
alutUnloadWAV(format, data, size, freq);
if ((AL_ERROR = alGetError()) != AL_NO_ERROR)
{
printf("alutUnloadWAV : %d", AL_ERROR);
alDeleteBuffers(AL_NUM_BUFFERS, buffers);
return 0;
}
alGenSources(AL_NUM_SOURCES, Sources);
if ((AL_ERROR = alGetError()) != AL_NO_ERROR)
{
printf("alGenSources : %d", AL_ERROR);
return 0;
}
for(int source = 0; source<=AL_NUM_SOURCES; source++)
{
alSourcei (Sources[source],AL_BUFFER,Buffers[source]);
if ((AL_ERROR = alGetError()) != AL_NO_ERROR)
{
printf("alSourcei : %d", AL_ERROR);
return 0;
}
alSourcef (Sources[source],AL_PITCH,1.0);
alSourcef (Sources[source],AL_GAIN,1.0);
alSourcefv(Sources[source],AL_POSITION,SourcePos);
alSourcefv(Sources[source],AL_VELOCITY,SourceVel);
alSourcefv(Sources[source],AL_DIRECTION,SourceOri);
alSourcei (Sources[source],AL_LOOPING,AL_FALSE);

}
alListenerfv(AL_POSITION,ListenerPos);
alListenerfv(AL_VELOCITY,ListenerVel);
alListenerfv(AL_ORIENTATION,ListenerOri);
[/code]
I searched around before posting this and couldn't find any topic with this specific problem.

Anyone who has experienced this problem before or understands a solution, feel free to help out a beginner.
I'm terrible with debugging new libraries; thank you in advance for any help.

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