Possible bug - pause and streaming buffers
I'm getting random crashes with the following error message:
OGRE EXCEPTION(40963:): Failed to unqueue Buffers: OpenAL Error: The value pointer given is not valid in OgreAL::Sound::unqueueBuffers
What's causing it is playing/pausing a sound in quick succession, I do this because in our applications we need the ability to stop and start at any point in order to set some stereo settings, this can be synched with audio so I also need to pause/unpause the audio at the same time.
I'm using boost and thread support but it doesn't look like a boost problem, I'll try and see if I can trace it but thought I'd bring it to your attention in case you know of a solution/reason for this.
edit: Further to this, if I don't stream the sound then the pause function resets the sound file..
Nope, I had not seen that one. I have some other problems to look into as well and I hope to get to them this weekend. Thanks for pointing it out.
I think I've solved the crash I was having which affected both pause/stop and resuming. I added in a state check in OgreALOggSound::updateSound():
if(mStream && (mSource != AL_NONE) && isPlaying())
It seems to cycle through the buffer queueing/unqueueing regardless of whether the sound is playing or not..??
Anyway, I haven't done exhaustive testing but it seems to work fine for what I was doing which was pausing/unpausing at upto 3 times a second.
Anyway, maybe it helps to pinpoint the exact cause of the crash as its definitey having problems stoping/resuming on my system.
[Edit] Still have the problem with non-streamed sounds restarting after being paused, for some reason in play() it drops into the if(!mBuffersQueued) block but I can't trace why this gets set?
Ah, thank you! I'll add that in!
Ok, I added this in and it seems to do the trick. I haven't ran into any issues where it falls into the if(!mBuffersQueued) section, but I'll keep playing with it and see what I can find! Thanks again for pointing this out!
Ok great, all I'm doing is using the same sound and switching between streaming/non-streamed and calling pause/play. When not streamed the sound resets to the start, when streamed its fine
I added some log text to trace it and its dropping into the if block for some reason, do you not get the same problem?
I wasn't switching between streaming and not. But that's the behavior I would expect. Why are you switching between streaming and non?
I'm not switching dynamically, I was merely testing that a non-streamed sound also paused/unpaused correctly, but it doesn't at the moment...
That's odd, I'll look into this tonight.