"Failed to bind Buffer:"Error

zillenjack

11-06-2009 15:36:12

Hello!

I am run this code for More than 20


mSoundMgr->destroySound(mSoundMgr->getSound("BGSound"));
sound = mSoundMgr->createSound("BGSound","aa.wav",true);

And then i am play it

sound->play();

Show Error "Failed to bind Buffer: OpenAL Error: The specified source name is not valid"
Why?
Thanks!

Phobius

11-06-2009 22:55:06

I think this is because sounds don't get deleted until a per-frame update. Have a look at the code, and you'll notice that sounds are queued in a deletion queue until the frame event, only then are they clear off, should there be any present. So you destroying a sound, then creating one of the same name may be causing that. Try creating the new sound with a different name, tell me if it still happens. If it does, it's something else. In this case, please provide a stack trace from when you get the exception.

Thanks.

zillenjack

12-06-2009 02:00:43

I am change the sound Name,
But show error too,
The sound type is ogg
I am load the same sound

OgreAL_d.dll!OgreAL::check(const int error=40961, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & description="Failed to bind Buffer", const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & source="OgreAL::Sound::queueBuffers") line 60 C++
OgreAL_d.dll!OgreAL::Sound::queueBuffers() line 886 + 0x62 字节 C++
OgreAL_d.dll!OgreAL::Sound::play() line 253 C++

Thanks for your help!
:D

Phobius

12-06-2009 11:50:36

Hmmm... I've taken a good long look at the code and I cannot see anything obviously wrong with the buffering. The OpenAL error doesn't tell me a whole heap either. Can you please produce a small test case that will replicate the fault so that I can run it locally and debug it for you? That would be awesome.

Thank you.

zillenjack

12-06-2009 13:01:47

Good evening! Phobius

It is such an
I define two variables

OgreAL::SoundManager* soundMgr;
OgreAL::Sound* mSound;


when createScene

soundMgr = new OgreAL::SoundManager();
for (int i=0;i<50;i++)
{
mSound = soundMgr->createSound("Roar", "Zero Factor - Decay.ogg", true);
soundMgr->destroySound(mSound);
}
mSound = soundMgr->createSound("Roar", "Zero Factor - Decay.ogg", true);
SceneNode* soundNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("soundNode");
soundNode->attachObject(mSound);

in the FrameListener Class
when the keyboard is down


if (mKeyboard->isKeyDown(OIS::KeyCode::KC_P))
{
app->mSound->play();
}

When i press the P
And then Show Error

if i am write the "mSound->play();" in createScene function
All is right

Thank you!
Enthusiastic friend

Phobius

13-06-2009 02:31:40

Thank you for the test case. First, before I even get onto trying it out, why are you doing this:


for (int i=0;i<50;i++)
{
mSound = soundMgr->createSound("Roar", "Zero Factor - Decay.ogg", true);
soundMgr->destroySound(mSound);
}


? You're creating a sound and then deleting it, 50 times. It's a little bizzare. What is it you want to achieve through this? In all honesty, doing that shouldn't cause the library to freak out, but it's still a very wasteful thing to do. I will give your testcase a shot soon.

Thanks.

zillenjack

13-06-2009 11:08:22

The reason why I did so because i am want to change the sound in the game.
But you are right
I should pre-load all songs
The game will be quick

zillenjack

13-06-2009 11:11:57

Now I practice for another
before the practice is unscientific

Thank you!

Phobius

13-06-2009 22:33:16

So, did you do something to fix your problem, or is this still an open issue? I'm not sure. I'll get around to it tonight if you're still having the problem.

Phobius

04-07-2009 11:48:01

I have come across this error myself and am investigating. Consider it an open issue.

Phobius

04-07-2009 12:05:59

This issue is now fixed.