Improve stop and rewind logic for openal

This commit is contained in:
Bart van Strien
2011-09-11 22:29:37 +02:00
parent 96a5a3e402
commit 8f9a4ef15d
2 changed files with 26 additions and 38 deletions
+1
View File
@@ -89,6 +89,7 @@ namespace openal
if(!i->first->update()) if(!i->first->update())
{ {
i->first->stopAtomic(); i->first->stopAtomic();
i->first->rewindAtomic();
i->first->release(); i->first->release();
available.push(i->second); available.push(i->second);
playing.erase(i); playing.erase(i);
+1 -14
View File
@@ -153,9 +153,7 @@ namespace openal
alSourcei(source, AL_LOOPING, isLooping() ? AL_TRUE : AL_FALSE); alSourcei(source, AL_LOOPING, isLooping() ? AL_TRUE : AL_FALSE);
return !isStopped(); return !isStopped();
} }
else if (type == TYPE_STREAM) else if (type == TYPE_STREAM && (isLooping() || !isFinished()))
{
if (isLooping() || !isFinished())
{ {
// Number of processed buffers. // Number of processed buffers.
ALint processed; ALint processed;
@@ -192,17 +190,6 @@ namespace openal
} }
return true; return true;
} }
else
{
// Actually stop the source,
// 'just running out' is bad
// practice, and prevents
// rewinds.
stopAtomic();
rewindAtomic();
return false;
}
}
return false; return false;
} }