first: thanks for making OgreAL, it's a nice addon to use in my projects
However i ran into an issue when re-creating a sound. To verify, please run this code:
A situation like this is common in a setup where you do some refreshing between loading a new level for example.
The third line throws an exception in Sound::createAndBindSource:
alSourceQueueBuffers(mSource, mNumBuffers, mBuffers);
CheckError(alGetError(), "Failed to bind Buffer");
Apparently the destructor of WavSound needs to do some cleanup?
Thanks and bye!
I'll take a look this evening when I get home. Thanks for the info.
yeah im getting the same error. when i recreate my car sounds when i swap states
EDIT* one of my sounds actually does get re-created with no troubles.. though the sound it does get this error on is my jump sound. I get this error when i try to do a destroySound(jumpName);
14:07:58: OGRE EXCEPTION(40964:): Failed to bind Buffer: OpenAL Error: There is no current context in OgreAL::Sound::createAndBindSource
14:08:07: *-*-* OgreAL Shutdown
14:08:07: OGRE EXCEPTION(40961:): Failed to delete Buffers, must still be in use.: OpenAL Error: The specified source name is not valid in OgreAL::Sound::~Sound
i get a fair amount of these errors too
The "Failed to delete Buffers, must still be in use." exception is not really a problem. What causes it is when you delete a Sound it tried to destroy the buffer that it was using, but if another sound is using the same buffer OpenAL won't allow this, so I catch the exception and print it out, just to be informative.
Crashing on recreation was due to the fact that the BufferMap wasn't being cleaned out when the buffer WAS deleted! Thanks for pointing this out! I have more changes I am going to commit in a bit once I get the chance to test them. The include being able to:
* Query the total length of the sound file in seconds (Thanks scriptkid!)
* Query the current offset into the audio in seconds
* Skip in the audio to a particular point in seconds
* Also cleaning up the way buffers and streaming are handled (Again, thanks scriptkid!)
* Of course, fixing the bug this thread addresses!
Please note though that i only patched the length() method for Ogg sounds (yet).
Yup, I got it working for wavs too, so it's all good!
Okay i tested the latest code and the results seem fine. Two small comments:
-I got a compile error because Sound::_updateSound is protected.
-The wav length calculation should be a floating point:
mLengthInSeconds = mDataSize / (mBufferSize * 4.f);
Cause it rounded at full seconds
Thanks and bye.