[Orxonox-commit 1470] r6188 - code/branches/presentation2/src/orxonox/sound

rgrieder at orxonox.net rgrieder at orxonox.net
Tue Dec 1 18:49:49 CET 2009


Author: rgrieder
Date: 2009-12-01 18:49:48 +0100 (Tue, 01 Dec 2009)
New Revision: 6188

Modified:
   code/branches/presentation2/src/orxonox/sound/BaseSound.cc
   code/branches/presentation2/src/orxonox/sound/BaseSound.h
Log:
Fixed a bug in BaseSound that caused every sound to play immediately when loaded.

Modified: code/branches/presentation2/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.cc	2009-12-01 17:48:51 UTC (rev 6187)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.cc	2009-12-01 17:49:48 UTC (rev 6188)
@@ -68,7 +68,7 @@
     {
         XMLPortParam(BaseSound, "volume", setVolume,  getVolume,  xmlelement, mode);
         XMLPortParam(BaseSound, "loop",   setLooping, getLooping, xmlelement, mode);
-        XMLPortParam(BaseSound, "play",   play,       isPlaying,  xmlelement, mode);
+        XMLPortParam(BaseSound, "play",   setPlaying, isPlaying,  xmlelement, mode);
         XMLPortParam(BaseSound, "source", setSource,  getSource,  xmlelement, mode);
     }
 

Modified: code/branches/presentation2/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.h	2009-12-01 17:48:51 UTC (rev 6187)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.h	2009-12-01 17:49:48 UTC (rev 6188)
@@ -58,6 +58,9 @@
         bool isPaused()  { return this->state_ == Paused; }
         bool isStopped() { return this->state_ == Stopped; }
 
+        void setPlaying(bool val)
+            { val ? this->play() : this->stop(); }
+
         virtual void setSource(const std::string& source);
         virtual const std::string& getSource() const { return this->source_; }
 




More information about the Orxonox-commit mailing list