nikki
17-11-2009 14:38:15
Hey!
I had a problem with stop() that kept saying 'invalid value pointer in unqueueBuffers'. This little change I found with help of a guy on IRC seems to fix it. You might be interested:-
Thanks for working on OgreAL, it's a great library!
I had a problem with stop() that kept saying 'invalid value pointer in unqueueBuffers'. This little change I found with help of a guy on IRC seems to fix it. You might be interested:-
Index: src/OgreALSound.cpp
===================================================================
--- src/OgreALSound.cpp (revision 130)
+++ src/OgreALSound.cpp (working copy)
@@ -1022,28 +1022,18 @@
void Sound::queueBuffers()
{
- alSourceQueueBuffers(mSource, mNumBuffers, mBuffers);
+ if(mNumBuffers == 1)
+ alSourcei(mSource, AL_BUFFER, mBuffers[0]);
+ else
+ alSourceQueueBuffers(mSource, mNumBuffers, mBuffers);
CheckError(alGetError(), "Failed to bind Buffer");
}
void Sound::unqueueBuffers()
{
- /*
- ** If the sound doesn't have a state yet it causes an
- ** error when you try to unqueue the buffers! :S In
- ** order to get around this we stop the source even if
- ** it wasn't playing.
- */
alSourceStop(mSource);
+ alSourcei(mSource, AL_BUFFER, 0);
CheckError(alGetError(), "Failed to stop sound");
-
- int queued;
- alGetSourcei(mSource, AL_BUFFERS_QUEUED, &queued);
- CheckError(alGetError(), "Failed to get Source");
-
- alSourceUnqueueBuffers(mSource, queued, mBuffers);
- CheckError(alGetError(), "Failed to unqueue Buffers");
-
mBuffersQueued = false;
}
Thanks for working on OgreAL, it's a great library!