Jump to content
  • Advertisement
Sign in to follow this  
xmanoux

OpenAL strange behaviour in an c++ object context

This topic is 2749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello!

I have a strange behaviour with using openAL in an object context.
I have identified and contourned the problem, but I don't understand what is wrong in the unfunctional version of my code.
So, if an C++ expert have an idea, I think it will help me to progress.

not working code:


class soundTransmitter
{
public:
ALuint hSource ;
soundTransmitter() //constructor
{
alGenSources(1, &hSource); //NO AL ERRORS
}
play()
{
ALuint hBuffer = alutCreateBufferFromFile("data/everybody.wav");
alSourceQueueBuffers(hSource,1,&hBuffer); //OPENAL ERROR AL_INVALID_NAME
alSourcePlay(hSource); //NO SOUND
}
}




Working code


class soundTransmitter
{
public:
ALuint hSource ;
soundTransmitter() //constructor
{
alGenSources(1, &hSource);
}
play()
{
ALuint hBuffer = alutCreateBufferFromFile("data/everybody.wav");
ALuint hSourceTMP = hSource ; //I CREATE A TEMPORY VAR TO STORE THE ATTRIBUTE INT
alSourceQueueBuffers(hSourceTMP,1,&hBuffer); //NO ERRORS
alSourcePlay(hSourceTMP); //SOUND !!!
}
}




Is anybody has an idea why, when used as a object instance attribute, an openAL int source handle crash ?

My platform is ubuntu with last openal libraries
Thanks a lot !!!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!