AH,seems i have found a bug,what u think~

zydgyy

11-02-2012 16:44:48

Hi,guys!
When i run the ManySources-Demo,when i press ESC to escape the app,then got a exception alert:invalid source name,it happend SoundManager destructor,it calls
OPENAL function:alDeleteSources(1, &mSourcePool.front());where this exception occured!
I traced all push and pop operation of mSourcePool,I found _releaseSource,this method, // No queued sounds.
}else{
mSourcePool.push(source);
,it push exceed source in the mSourcePool,so,make quote]alDeleteSources(1, &mSourcePool.front()); delete a source more than a time!
Finally,I found in the method SourceRef SoundManager::_requestSource(Sound *sound),
else if(!mActiveSounds.empty())
{
Sound *activeSound = mActiveSounds.front();
Ogre::Vector3 listenerPos = Listener::getSingleton().getDerivedPosition();
Ogre::Real distSound = sound->getDerivedPosition().distance(listenerPos);
Ogre::Real distActiveSound = activeSound->getDerivedPosition().distance(listenerPos);

if(sound->getPriority() > activeSound->getPriority() ||
sound->getPriority() == activeSound->getPriority() && distSound < distActiveSound)
{
activeSound->pause();
SourceRef source = activeSound->getSource();
mActiveSounds.erase(mActiveSounds.begin());
mQueuedSounds.push_back(activeSound);
activeSound->setSource(AL_NONE);/////////////???????????????????????This line is missed in the source
mActiveSounds.push_back(sound);
return source;
}
else
{
mQueuedSounds.push_back(sound);
return AL_NONE;
}
}

The source missed the marked line ,which means paused sound SHOULD release it's source!Am i right????Welcome to discuss!!!!