[Orxonox-commit 1236] r5954 - code/branches/sound3/src/orxonox/sound
youngk at orxonox.net
youngk at orxonox.net
Wed Oct 14 16:59:47 CEST 2009
Author: youngk
Date: 2009-10-14 16:59:47 +0200 (Wed, 14 Oct 2009)
New Revision: 5954
Modified:
code/branches/sound3/src/orxonox/sound/BaseSound.cc
Log:
Bug Fix: SoundBase. The old sound file is now automatically unloaded upon change of sound file.
Modified: code/branches/sound3/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/BaseSound.cc 2009-10-14 14:36:56 UTC (rev 5953)
+++ code/branches/sound3/src/orxonox/sound/BaseSound.cc 2009-10-14 14:59:47 UTC (rev 5954)
@@ -110,16 +110,24 @@
void BaseSound::setSource(const std::string& source)
{
- this->source_ = source;
- if (!GameMode::playsSound())
+ if (!GameMode::playsSound())
+ {
+ this->source_ = source;
return;
-
- if (source.empty() && alIsSource(this->audioSource_))
+ }
+
+ if (this->source_ != source && alIsSource(this->audioSource_))
{
// Unload sound
alSourcei(this->audioSource_, AL_BUFFER, 0);
alDeleteSources(1, &this->audioSource_);
alDeleteBuffers(1, &this->audioBuffer_);
+ }
+
+ this->source_ = source;
+
+ if(source_.empty())
+ {
return;
}
More information about the Orxonox-commit
mailing list