[Orxonox-commit 5226] r9889 - in code/branches/sfxThilo: data/defaultConfig data/levels data/levels/templates src/modules/pong src/orxonox src/orxonox/items src/orxonox/sound src/orxonox/weaponsystem src/orxonox/worldentities/pawns

thiweber at orxonox.net thiweber at orxonox.net
Mon Dec 9 16:06:38 CET 2013


Author: thiweber
Date: 2013-12-09 16:06:38 +0100 (Mon, 09 Dec 2013)
New Revision: 9889

Modified:
   code/branches/sfxThilo/data/defaultConfig/keybindings.ini
   code/branches/sfxThilo/data/levels/Spacerace2.oxw
   code/branches/sfxThilo/data/levels/asteroidField.oxw
   code/branches/sfxThilo/data/levels/asteroids.oxw
   code/branches/sfxThilo/data/levels/dynamicMatch.oxw
   code/branches/sfxThilo/data/levels/lastManStanding.oxw
   code/branches/sfxThilo/data/levels/lastTeamStanding.oxw
   code/branches/sfxThilo/data/levels/lastTeamStandingII.oxw
   code/branches/sfxThilo/data/levels/maxim.oxw
   code/branches/sfxThilo/data/levels/pirateAttack.oxw
   code/branches/sfxThilo/data/levels/pong.oxw
   code/branches/sfxThilo/data/levels/presentationHS12.oxw
   code/branches/sfxThilo/data/levels/spaceRace.oxw
   code/branches/sfxThilo/data/levels/surfaceRace.oxw
   code/branches/sfxThilo/data/levels/teamBaseMatch.oxw
   code/branches/sfxThilo/data/levels/teamDeathMatch.oxw
   code/branches/sfxThilo/data/levels/templates/spaceshipAssff.oxt
   code/branches/sfxThilo/data/levels/underAttack.oxw
   code/branches/sfxThilo/src/modules/pong/PongBall.cc
   code/branches/sfxThilo/src/modules/pong/PongBall.h
   code/branches/sfxThilo/src/orxonox/MoodManager.h
   code/branches/sfxThilo/src/orxonox/items/MultiStateEngine.cc
   code/branches/sfxThilo/src/orxonox/sound/AmbientSound.cc
   code/branches/sfxThilo/src/orxonox/sound/AmbientSound.h
   code/branches/sfxThilo/src/orxonox/sound/BaseSound.cc
   code/branches/sfxThilo/src/orxonox/sound/SoundManager.cc
   code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.cc
   code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.h
   code/branches/sfxThilo/src/orxonox/sound/WorldSound.cc
   code/branches/sfxThilo/src/orxonox/weaponsystem/WeaponMode.cc
   code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.h
Log:
A few changes..

Modified: code/branches/sfxThilo/data/defaultConfig/keybindings.ini
===================================================================
--- code/branches/sfxThilo/data/defaultConfig/keybindings.ini	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/defaultConfig/keybindings.ini	2013-12-09 15:06:38 UTC (rev 9889)
@@ -57,7 +57,7 @@
 KeyLeftShif
 KeyLeftWindows=
 KeyLessThan=
-KeyM=
+KeyM="WorldAmbientSound nextsong"
 KeyMail=
 KeyMediaSelect=
 KeyMediaStop=

Modified: code/branches/sfxThilo/data/levels/Spacerace2.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/Spacerace2.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/Spacerace2.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -13,7 +13,9 @@
   include("templates/spaceshipAssff.oxt")
 
 ?>
+<WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" />
 
+
 <?lua
   include("templates/spaceshipAssff2.oxt")
   include("templates/spaceshipPirate.oxt")

Modified: code/branches/sfxThilo/data/levels/asteroidField.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/asteroidField.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/asteroidField.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -10,6 +10,7 @@
   include("HUDTemplates3.oxo")
   include("templates/lodInformation.oxt")
 ?>
+<WorldAmbientSound source="Asteroid_rocks.ogg" looping="true" playOnLoad="true" />
 
 <?lua
   include("templates/spaceshipAssff.oxt")

Modified: code/branches/sfxThilo/data/levels/asteroids.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/asteroids.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/asteroids.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -4,6 +4,7 @@
  tags = "gametype"
  screenshot = "asteroids.png"
 />
+<WorldAmbientSound source="Asteroid_rocks.ogg" looping="true" playOnLoad="true" />
 
 <?lua
   include("HUDTemplates3.oxo")

Modified: code/branches/sfxThilo/data/levels/dynamicMatch.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/dynamicMatch.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/dynamicMatch.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -4,6 +4,7 @@
  tags = "gametype"
  screenshot = "dynamicMatch.png"
 />
+<WorldAmbientSound source="Mars.ogg" looping="true" playOnLoad="true" />
 
 <?lua
   include("HUDTemplates3.oxo")

Modified: code/branches/sfxThilo/data/levels/lastManStanding.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/lastManStanding.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/lastManStanding.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -31,6 +31,8 @@
     <?lua
       include("includes/pickups.oxi")
     ?>
+    
+    <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" />
 
 <!----- Spawnpoints
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>

Modified: code/branches/sfxThilo/data/levels/lastTeamStanding.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/lastTeamStanding.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/lastTeamStanding.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -32,6 +32,8 @@
     <?lua
       include("includes/pickups.oxi")
     ?>
+    
+    <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" />
 
 <Bot />
 

Modified: code/branches/sfxThilo/data/levels/lastTeamStandingII.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/lastTeamStandingII.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/lastTeamStandingII.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -26,6 +26,8 @@
     ambientlight = "0.8, 0.8, 0.8"
     skybox       = "Orxonox/skyBoxBasic"
   >
+  <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" />
+  
 <!-- TODO:
 1. make collisionshapes bulletproof: -> attach movable entity with dynamic collisionshape within a static collisionshape 
 2. add forcefields -> there should be several "streams" through the level

Modified: code/branches/sfxThilo/data/levels/maxim.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/maxim.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/maxim.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -24,6 +24,8 @@
     <Template link=lodtemplate_default />
   </templates>
   <?lua include("includes/notifications.oxi") ?>
+  
+  <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" />
 
   <NotificationQueueCEGUI
     name="narrative"

Modified: code/branches/sfxThilo/data/levels/pirateAttack.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/pirateAttack.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/pirateAttack.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -24,6 +24,8 @@
 <?lua
     dofile("includes/CuboidSpaceStation.lua")
 ?>
+
+<WorldAmbientSound source="Mars.ogg" looping="true" playOnLoad="true" />
     
 <Level
 name="Dani's Testlevel"

Modified: code/branches/sfxThilo/data/levels/pong.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/pong.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/pong.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -34,8 +34,9 @@
 
 <Template name=pongball>
   <PongBall 
-   defScoreSound = "sounds/Button.ogg"
-   defBoundarySound = "sounds/Button_press2.ogg">
+   defScoreSound = "sounds/PlayerWinScore_cut.ogg"
+   defBatSound = "sounds/Button.ogg"
+   defBoundarySound = "sounds/Button.ogg">
     <attached>
       <Model mesh="sphere.mesh" scale=2 />
       <!--Billboard scale=0.2 colour="1.0, 1.0, 0.5" material="Examples/Flare" /-->

Modified: code/branches/sfxThilo/data/levels/presentationHS12.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/presentationHS12.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/presentationHS12.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -485,7 +485,7 @@
 
 
 <!-- SOUNDS & MUSIC -->
-            <WorldSound name="scoreSound" position="-920,0,0" source="sounds/ReadyGo.ogg" >
+            <WorldSound name="scoreSound" position="-920,0,0" source="sounds/Button.ogg" >
               <events>
                 <play>
                   <EventListener event="start" />

Modified: code/branches/sfxThilo/data/levels/spaceRace.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/spaceRace.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/spaceRace.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -28,6 +28,9 @@
     ambientlight = "0.8, 0.8, 0.8"
     skybox       = "Orxonox/skyBoxMoreNebula"
   >
+  
+  <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" />
+  
 
     <?lua math.randomseed(98) ?>
 

Modified: code/branches/sfxThilo/data/levels/surfaceRace.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/surfaceRace.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/surfaceRace.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -9,6 +9,7 @@
  screenshot = "surfaceRace.png"
  tags = "gametype"
 />
+<WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" />
 
 <?lua
   include("stats.oxo")

Modified: code/branches/sfxThilo/data/levels/teamBaseMatch.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/teamBaseMatch.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/teamBaseMatch.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -18,6 +18,8 @@
  gametype = "TeamBaseMatch"
 >
 
+<WorldAmbientSound source="Jupiter.ogg" looping="true" playOnLoad="true" />
+
   <templates>
     <Template link=lodtemplate_default />
   </templates>

Modified: code/branches/sfxThilo/data/levels/teamDeathMatch.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/teamDeathMatch.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/teamDeathMatch.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -21,6 +21,8 @@
     <Template link=lodtemplate_default />
   </templates>
   <?lua include("includes/notifications.oxi") ?>
+  
+  <WorldAmbientSound source="Jupiter.ogg" looping="true" playOnLoad="true" />
 
   <Scene
    ambientlight = "0.7, 0.6, 0.6"

Modified: code/branches/sfxThilo/data/levels/templates/spaceshipAssff.oxt
===================================================================
--- code/branches/sfxThilo/data/levels/templates/spaceshipAssff.oxt	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/templates/spaceshipAssff.oxt	2013-12-09 15:06:38 UTC (rev 9889)
@@ -36,6 +36,8 @@
    mass              = 100
    linearDamping     = 0.7
    angularDamping    = 0.9999999
+
+   explosionSound = "sounds/Explosion2.ogg"
   >
     <engines>
       <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
@@ -81,7 +83,7 @@
 
    defEngineSndNormal = "sounds/Engine_low.ogg"
    defEngineSndBoost = "sounds/Engine_high.ogg"
-
+   
    accelerationfront     = 500
    accelerationbrake     = 500
    accelerationback      =  125

Modified: code/branches/sfxThilo/data/levels/underAttack.oxw
===================================================================
--- code/branches/sfxThilo/data/levels/underAttack.oxw	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/data/levels/underAttack.oxw	2013-12-09 15:06:38 UTC (rev 9889)
@@ -19,6 +19,7 @@
     <Template link=lodtemplate_default />
   </templates>
   <?lua include("includes/notifications.oxi") ?>
+  <WorldAmbientSound source="Jupiter.ogg" looping="true" playOnLoad="true" />
 
   <Scene
    ambientlight = "0.5, 0.5, 0.5"

Modified: code/branches/sfxThilo/src/modules/pong/PongBall.cc
===================================================================
--- code/branches/sfxThilo/src/modules/pong/PongBall.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/modules/pong/PongBall.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -40,7 +40,7 @@
 
 #include "PongBat.h"
 
-#include "sound/WorldSound.h" //Thilo
+#include "sound/WorldSound.h"
 #include "core/XMLPort.h"
 
 namespace orxonox
@@ -69,19 +69,21 @@
 
         this->registerVariables();
 
-        //Thilo
+        //initialize sound
         if (GameMode::isMaster())
              {
                  this->defScoreSound_ = new WorldSound(this->getContext());
-                 this->defScoreSound_->setLooping(false);
+                 this->defScoreSound_->setVolume(1.0f);
                  this->defBatSound_ = new WorldSound(this->getContext());
-                 this->defBatSound_->setLooping(false);
+                 this->defBatSound_->setVolume(0.4f);
                  this->defBoundarySound_ = new WorldSound(this->getContext());
-                 this->defBoundarySound_->setLooping(false);
+                 this->defBoundarySound_->setVolume(0.5f);
              }
              else
              {
                  this->defScoreSound_ = 0;
+                 this->defBatSound_ = 0;
+                 this->defBoundarySound_ = 0;
              }
     }
 
@@ -100,7 +102,7 @@
         }
     }
 
-    //Thilo
+    //xml port for loading sounds
     void PongBall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(PongBall, XMLPort, xmlelement, mode);
@@ -143,7 +145,8 @@
         // If the ball has gone over the top or bottom boundary of the playing field (i.e. the ball has hit the top or bottom delimiters).
         if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
         {
-            // Its velocity in z-direction is inverted (i.e. it bounces off).
+            defBoundarySound_->play(); //play boundary sound
+        	// Its velocity in z-direction is inverted (i.e. it bounces off).
             velocity.z = -velocity.z;
             // And its position is set as to not overstep the boundary it has just crossed.
             if (position.z > this->fieldHeight_ / 2)
@@ -168,7 +171,8 @@
                     distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
                     if (fabs(distance) <= 1) // If the bat is there to parry.
                     {
-                        // Set the ball to be exactly at the boundary.
+                        defBatSound_->play(); //play bat sound
+                    	// Set the ball to be exactly at the boundary.
                         position.x = this->fieldWidth_ / 2;
                         // Invert its velocity in x-direction (i.e. it bounces off).
                         velocity.x = -velocity.x;
@@ -181,7 +185,7 @@
                     // If the left player scores.
                     else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
                     {
-                    	defScoreSound_->play();//Thilo
+                    	defScoreSound_->play();//play score sound
                         if (this->getGametype() && this->bat_[0])
                         {
                             this->getGametype()->playerScored(this->bat_[0]->getPlayer());
@@ -196,7 +200,8 @@
                     distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
                     if (fabs(distance) <= 1) // If the bat is there to parry.
                     {
-                        // Set the ball to be exactly at the boundary.
+                        defBatSound_->play(); //play bat sound
+                    	// Set the ball to be exactly at the boundary.
                         position.x = -this->fieldWidth_ / 2;
                         // Invert its velocity in x-direction (i.e. it bounces off).
                         velocity.x = -velocity.x;
@@ -209,7 +214,7 @@
                     // If the right player scores.
                     else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
                     {
-                    	defScoreSound_->play();//Thilo
+                    	defScoreSound_->play();//play score sound
                         if (this->getGametype() && this->bat_[1])
                         {
                             this->getGametype()->playerScored(this->bat_[1]->getPlayer());

Modified: code/branches/sfxThilo/src/modules/pong/PongBall.h
===================================================================
--- code/branches/sfxThilo/src/modules/pong/PongBall.h	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/modules/pong/PongBall.h	2013-12-09 15:06:38 UTC (rev 9889)
@@ -125,8 +125,12 @@
 
             static const float MAX_REL_Z_VELOCITY;
 
-            void setDefScoreSound(const std::string& engineSound); //Thilo
-            const std::string& getDefScoreSound(); //Thilo
+            void setDefScoreSound(const std::string& engineSound);
+            const std::string& getDefScoreSound();
+            void setDefBatSound(const std::string& engineSound);
+            const std::string& getDefBatSound();
+            void setDefBoundarySound(const std::string& engineSound);
+            const std::string& getDefBoundarySound();
 
         private:
             void registerVariables();
@@ -140,7 +144,9 @@
             bool bDeleteBats_; //!< Bool, to keep track, of whether this->bat_ exists or not.
             unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network.
             float relMercyOffset_; //!< Offset, that makes the player not loose, when, in all fairness, he would have.
-            WorldSound* defScoreSound_;//Thilo
+            WorldSound* defScoreSound_;
+            WorldSound* defBatSound_;
+            WorldSound* defBoundarySound_;
     };
 }
 

Modified: code/branches/sfxThilo/src/orxonox/MoodManager.h
===================================================================
--- code/branches/sfxThilo/src/orxonox/MoodManager.h	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/MoodManager.h	2013-12-09 15:06:38 UTC (rev 9889)
@@ -50,7 +50,7 @@
             virtual ~MoodListener() {}
 
         private:
-            virtual void moodChanged(const std::string& mood) = 0;
+            virtual bool moodChanged(const std::string& mood) = 0;
 
             static void changedMood(const std::string& mood);
     };

Modified: code/branches/sfxThilo/src/orxonox/items/MultiStateEngine.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/items/MultiStateEngine.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/items/MultiStateEngine.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -60,6 +60,8 @@
             this->defEngineSndBoost_  = new WorldSound(this->getContext());
             this->defEngineSndNormal_->setLooping(true);
             this->defEngineSndBoost_->setLooping(true);
+            this->defEngineSndNormal_->setVolume(0.8f);
+            this->defEngineSndBoost_->setVolume(0.5f);
             this->lua_ = new LuaState();
         }
         else

Modified: code/branches/sfxThilo/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/sound/AmbientSound.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/sound/AmbientSound.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -78,13 +78,13 @@
         return SoundManager::getInstance().getRealVolume(SoundType::Music);
     }
 
-    void AmbientSound::setAmbientSource(const std::string& source)
+    bool AmbientSound::setAmbientSource(const std::string& source)
     {
         this->ambientSource_ = source;
-        this->moodChanged(MoodManager::getInstance().getMood());
+        return(this->moodChanged(MoodManager::getInstance().getMood()));
     }
 
-    void AmbientSound::moodChanged(const std::string& mood)
+    bool AmbientSound::moodChanged(const std::string& mood)
     {
         if (GameMode::playsSound())
         {
@@ -94,12 +94,19 @@
             {
                 orxout(user_info) << "Loading ambient sound " << path << "..." << endl; // TODO: make this output internal if we implement sound streaming
                 this->setSource(path);
+
+                // all went fine
+                return true;
             }
             else
             {
                 orxout(internal_warning, context::sound) << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << endl;
+
+                // everything went southways
+                return false;
             }
         }
+        return false;
     }
 
     void AmbientSound::setPlayOnLoad(bool val)

Modified: code/branches/sfxThilo/src/orxonox/sound/AmbientSound.h
===================================================================
--- code/branches/sfxThilo/src/orxonox/sound/AmbientSound.h	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/sound/AmbientSound.h	2013-12-09 15:06:38 UTC (rev 9889)
@@ -53,7 +53,7 @@
         bool stop();
         void pause();
 
-        void setAmbientSource(const std::string& source);
+        bool setAmbientSource(const std::string& source);
         inline const std::string& getAmbientSource() const
             { return this->ambientSource_; }
 
@@ -67,7 +67,7 @@
     private:
         void preDestroy();
         float getRealVolume();
-        void moodChanged(const std::string& mood);
+        bool moodChanged(const std::string& mood);
         inline void ambientSourceChanged()
             { this->setAmbientSource(this->ambientSource_); }
         inline void playOnLoadChanged()

Modified: code/branches/sfxThilo/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/sound/BaseSound.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/sound/BaseSound.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -46,7 +46,7 @@
 
     BaseSound::BaseSound()
         : bPooling_(false)
-        , volume_(1.0)
+        , volume_(0.7)
         , bLooping_(false)
         , state_(Stopped)
         , pitch_ (1.0)

Modified: code/branches/sfxThilo/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/sound/SoundManager.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/sound/SoundManager.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -217,7 +217,7 @@
         SetConfigValueAlias(volume_[SoundType::All], "soundVolume_", 1.0f)
             .description("Defines the overall volume.")
             .callback(this, &SoundManager::checkSoundVolumeValidity);
-        SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 1.0f)
+        SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 0.7f)
             .description("Defines the ambient volume.")
             .callback(this, &SoundManager::checkAmbientVolumeValidity);
         SetConfigValueAlias(volume_[SoundType::Effects], "effectsVolume_", 1.0f)

Modified: code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -32,9 +32,14 @@
 #include "core/EventIncludes.h"
 #include "core/XMLPort.h"
 #include "AmbientSound.h"
+#include "core/command/ConsoleCommand.h"
+#include <exception>
 
+
 namespace orxonox
 {
+	SetConsoleCommand("WorldAmbientSound", "nextsong",      &WorldAmbientSound::nextSong);
+
     RegisterClass(WorldAmbientSound);
 
     WorldAmbientSound::WorldAmbientSound(Context* context) : BaseObject(context), Synchronisable(context)
@@ -43,13 +48,23 @@
 
         this->ambientSound_ = new AmbientSound();
         this->registerVariables();
+        soundList_.push_back("Earth.ogg");
+        soundList_.push_back("Jupiter.ogg");
+        soundList_.push_back("Mars.ogg");
+        soundList_.push_back("allgorythm-lift_up.ogg");
+        soundList_.push_back("allgorythm-resonance_blaster.ogg");
+        soundList_.push_back("AlphaCentauri.ogg");
+        soundList_.push_back("Asteroid_rocks.ogg");
+        soundList_.push_back("Ganymede.ogg");
+        soundList_.push_back("luke_grey_-_hypermode.ogg");
+
     }
-
     WorldAmbientSound::~WorldAmbientSound()
     {
         if (this->isInitialized())
         {
             this->ambientSound_->destroy();
+            WorldAmbientSound::soundList_.clear();
         }
     }
 
@@ -93,4 +108,18 @@
         else
             this->ambientSound_->stop();
     }
+
+    void WorldAmbientSound::nextSong()
+    {
+
+    	//HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used.
+    	for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin();
+    	     it != ObjectList<WorldAmbientSound>::end(); ++it)
+    	{
+    		while(it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
+    			WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
+    		}
+    		WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
+    	}
+    }
 }

Modified: code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.h
===================================================================
--- code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.h	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.h	2013-12-09 15:06:38 UTC (rev 9889)
@@ -33,7 +33,10 @@
 
 #include "core/BaseObject.h"
 #include "network/synchronisable/Synchronisable.h"
+#include <string>
+#include <vector>
 
+
 namespace orxonox
 {
     /**
@@ -53,11 +56,31 @@
 
             void play();
 
+            //This function changes the current ambient song.
+            //You can call nextSong() active in the level
+            //by pressing the key 'M'.
+            static void nextSong();
+
         private:
             void registerVariables();
 
+            //Vector with the diffrent available level sounds.
+            //The sound names are pushed in the WorldAmbientSound-constructor.
+            static std::vector<std::string> soundList_;
+
+            // This value will be initialized below, don't make this into
+            // a const, since we want to change it in nextSong().
+            static int soundNumber_;
+
+
             AmbientSound* ambientSound_;
     };
+
+    // This is an initialization for the soundnumber variable. Since it is
+    // static, we have to initialize it this way.
+    int WorldAmbientSound::soundNumber_ = 0;
+    std::vector<std::string> WorldAmbientSound::soundList_;
+
 }
 
 #endif /* _WorldAmbientSound_H__ */

Modified: code/branches/sfxThilo/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/sound/WorldSound.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/sound/WorldSound.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -80,7 +80,7 @@
             float refDist = this->getScene()->getSoundReferenceDistance();
             alSourcef(this->audioSource_, AL_REFERENCE_DISTANCE, refDist);
             // TODO: 500 is very magical here. Derive something better
-            alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 500);
+            alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 20);
         }
         this->tick(0); // update position, orientation and velocity
     }

Modified: code/branches/sfxThilo/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/weaponsystem/WeaponMode.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/weaponsystem/WeaponMode.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -78,6 +78,7 @@
         {
             this->defSndWpnFire_ = new WorldSound(this->getContext());
             this->defSndWpnFire_->setLooping(false);
+            this->defSndWpnFire_->setVolume(0.8f);
             this->bSoundAttached_ = false;
         }
         else

Modified: code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.cc	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.cc	2013-12-09 15:06:38 UTC (rev 9889)
@@ -45,6 +45,7 @@
 #include "weaponsystem/WeaponSlot.h"
 #include "weaponsystem/WeaponPack.h"
 #include "weaponsystem/WeaponSet.h"
+#include "sound/WorldSound.h"
 
 #include "controllers/FormationController.h"
 
@@ -99,6 +100,16 @@
         this->isHumanShip_ = this->hasLocalController();
 
         this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition
+
+        if (GameMode::isMaster())
+        {
+            this->explosionSound_ = new WorldSound(this->getContext());
+            this->explosionSound_->setVolume(1.0f);
+        }
+        else
+        {
+            this->explosionSound_ = 0;
+        }
     }
 
     Pawn::~Pawn()
@@ -108,6 +119,7 @@
             if (this->weaponSystem_)
                 this->weaponSystem_->destroy();
         }
+
     }
 
     void Pawn::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -134,9 +146,12 @@
         XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
         XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
 
+        XMLPortParam(Pawn, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
+
         XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
     }
 
+
     void Pawn::registerVariables()
     {
         registerVariable(this->bAlive_,           VariableDirection::ToClient);
@@ -289,7 +304,7 @@
 
     void Pawn::kill()
     {
-        this->damage(this->health_);
+    	this->damage(this->health_);
         this->death();
     }
 
@@ -313,7 +328,8 @@
         this->setHealth(1);
         if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
         {
-            // Set bAlive_ to false and wait for PawnManager to do the destruction
+            explosionSound_->play();
+        	// Set bAlive_ to false and wait for PawnManager to do the destruction
             this->bAlive_ = false;
 
             this->setDestroyWhenPlayerLeft(false);
@@ -526,5 +542,22 @@
     }
 
 
+    void Pawn::setExplosionSound(const std::string &explosionSound)
+    {
+        if(explosionSound_ )
+            explosionSound_->setSource(explosionSound);
+        else
+            assert(0); // This should never happen, because soundpointer is only available on master
+    }
 
+    const std::string& Pawn::getExplosionSound()
+    {
+        if( explosionSound_ )
+            return explosionSound_->getSource();
+        else
+            assert(0);
+        return BLANKSTRING;
+    }
+
+
 }

Modified: code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.h	2013-12-09 15:02:50 UTC (rev 9888)
+++ code/branches/sfxThilo/src/orxonox/worldentities/pawns/Pawn.h	2013-12-09 15:06:38 UTC (rev 9889)
@@ -36,6 +36,7 @@
 #include "interfaces/RadarViewable.h"
 #include "worldentities/ControllableEntity.h"
 
+
 namespace orxonox // tolua_export
 { // tolua_export
     class _OrxonoxExport Pawn // tolua_export
@@ -177,6 +178,9 @@
 
             virtual void changedVisibility();
 
+            void setExplosionSound(const std::string& engineSound);
+            const std::string& getExplosionSound();
+
         protected:
             virtual void preDestroy();
 
@@ -230,6 +234,9 @@
                 { this->weaponSystem_ = weaponsystem; }
 
             Vector3 aimPosition_;
+
+            WorldSound* explosionSound_;
+
     }; // tolua_export
 } // tolua_export
 




More information about the Orxonox-commit mailing list