Index: /code/branches/sound3/src/orxonox/sound/AmbientSound.cc
===================================================================
--- /code/branches/sound3/src/orxonox/sound/AmbientSound.cc	(revision 6045)
+++ /code/branches/sound3/src/orxonox/sound/AmbientSound.cc	(revision 6046)
@@ -65,32 +65,37 @@
     {
         COUT(3) << this->getSource() << ": Playing" << std::endl;
-        SoundManager::getInstance().registerAmbientSound(this);
-        SUPER(AmbientSound, play);
+        if(GameMode::playsSound())
+        {
+            SoundManager::getInstance().registerAmbientSound(this);
+            this->BaseSound::play();
+        }
     }
 
     void AmbientSound::replay()
     {
-        SUPER(AmbientSound, play);
+        this->BaseSound::play();
     }
 
     void AmbientSound::stop()
     {
-        SUPER(AmbientSound, stop);
-        SoundManager::getInstance().unregisterAmbientSound(this);
+        if(GameMode::playsSound())
+        {
+            SoundManager::getInstance().unregisterAmbientSound(this);
+        }
     }
 
-    void AmbientSound::pause()
+    void AmbientSound::doStop()
     {
-        SUPER(AmbientSound, pause);
+        this->BaseSound::stop();
     }
 
     void AmbientSound::setSource(const std::string& source)
     {
-        if(source.find('/') == std::string.npos)
+        if(source.find('/') == std::string.npos && GameMode::playsSound())
         {
             std::string filePath = SoundManager::getInstance().getAmbientPath(source);
             if(!(filePath.empty()))
             {
-                BaseSound::setSource(filePath);
+                this->BaseSound::setSource(filePath);
                 return;
             }
@@ -102,5 +107,5 @@
     {
         COUT(3) << this->getSource() << ": ChangedActivity: " << this->isActive() << std::endl;
-        SUPER(AmbientSound, changedActivity);
+        this->BaseObject::changedActivity();
         if(this->isActive())
         {
@@ -112,4 +117,3 @@
         }
     }
-
 }
Index: /code/branches/sound3/src/orxonox/sound/AmbientSound.h
===================================================================
--- /code/branches/sound3/src/orxonox/sound/AmbientSound.h	(revision 6045)
+++ /code/branches/sound3/src/orxonox/sound/AmbientSound.h	(revision 6046)
@@ -48,7 +48,7 @@
 
         virtual void play();
-        virtual void replay();      // is only needed for the AmbientSound list in SoundManager
+        void replay();      // Continue playing without re-registering the sound
         virtual void stop();
-        virtual void pause();
+        void doStop();
 
         virtual void setSource(const std::string& source);
Index: /code/branches/sound3/src/orxonox/sound/BaseSound.cc
===================================================================
--- /code/branches/sound3/src/orxonox/sound/BaseSound.cc	(revision 6045)
+++ /code/branches/sound3/src/orxonox/sound/BaseSound.cc	(revision 6046)
@@ -70,9 +70,4 @@
     }
 
-    void BaseSound::replay()
-    {
-        BaseSound::play();
-    }
-
     void BaseSound::stop()
     {
@@ -185,4 +180,9 @@
         if (this->bPlayOnLoad_)
             this->play();
+    }
+
+    ALuint BaseSound::getALAudioSource()
+    {
+        return audioSource_;
     }
 
Index: /code/branches/sound3/src/orxonox/sound/BaseSound.h
===================================================================
--- /code/branches/sound3/src/orxonox/sound/BaseSound.h	(revision 6045)
+++ /code/branches/sound3/src/orxonox/sound/BaseSound.h	(revision 6046)
@@ -50,7 +50,6 @@
 
         virtual void play();
-        virtual void replay();      // is only needed for the AmbientSound list in SoundManager
         virtual void stop();
-        virtual void pause();
+        void pause();
 
         bool isPlaying();
@@ -66,4 +65,6 @@
         bool getLoop() { return this->bLoop_; }
         void setLoop(bool val) { this->bLoop_ = val; }
+
+        ALuint getALAudioSource(void);
 
     protected:
Index: /code/branches/sound3/src/orxonox/sound/SoundManager.cc
===================================================================
--- /code/branches/sound3/src/orxonox/sound/SoundManager.cc	(revision 6045)
+++ /code/branches/sound3/src/orxonox/sound/SoundManager.cc	(revision 6046)
@@ -35,9 +35,12 @@
 #include "util/ScopeGuard.h"
 #include "util/StringUtils.h"
+#include "util/Clock.h"
 #include "core/GameMode.h"
 #include "core/ScopedSingletonManager.h"
 #include "core/Resource.h"
+#include "core/ConfigValueIncludes.h"
 #include "BaseSound.h"
 #include "MoodManager.h"
+#include "AmbientSound.h"
 
 namespace orxonox
@@ -48,4 +51,6 @@
     SoundManager::SoundManager()
     {
+        RegisterRootObject(SoundManager);
+
         if (!alutInitWithoutContext(NULL,NULL))
             ThrowException(InitialisationFailed, "Sound: OpenAL ALUT error: " << alutGetErrorString(alutGetError()));
@@ -86,4 +91,6 @@
         closeDeviceGuard.Dismiss();
         desroyContextGuard.Dismiss();
+
+        this->setConfigValues();
     }
 
@@ -96,4 +103,17 @@
     }
 
+    void SoundManager::update(const Clock &time)
+    {
+        this->fadeInAmbientSound(time.getDeltaTime());
+        this->fadeOutAmbientSound(time.getDeltaTime());
+    }
+
+    void SoundManager::setConfigValues()
+    {
+        SetConfigValue(fadeStep_, 0.2f)
+            .description("Determines how fast sounds should fade, per second.")
+            .callback(this, &SoundManager::checkFadeStepValidity);
+    }
+
     void SoundManager::setListenerPosition(const Vector3& position)
     {
@@ -119,14 +139,18 @@
     }
 
-    void SoundManager::registerAmbientSound(BaseSound* newAmbient)
-    {
-        if (!(this->ambientSounds_.empty())) 
-        {
-            this->ambientSounds_.front()->pause();
-        }
-        this->ambientSounds_.push_front(newAmbient);
-    }
-
-    void SoundManager::unregisterAmbientSound(BaseSound* currentAmbient)
+    void SoundManager::registerAmbientSound(AmbientSound* newAmbient)
+    {
+        if(newAmbient != NULL)
+        {
+            if (!(this->ambientSounds_.empty())) 
+            {
+                this->fadeOutList_.push_front(std::make_pair(this->ambientSounds_.front(), 1.0));
+            }
+            this->fadeInList_.push_front(std::make_pair(newAmbient, 0.0));
+            this->ambientSounds_.push_front(newAmbient);
+        }
+    }
+
+    void SoundManager::unregisterAmbientSound(AmbientSound* currentAmbient)
     {
         if(currentAmbient == NULL || ambientSounds_.empty())
@@ -136,16 +160,18 @@
         if(this->ambientSounds_.front() == currentAmbient) 
         {
+            this->fadeOutList_.push_front(std::make_pair(this->ambientSounds_.front(), 1.0));
             this->ambientSounds_.pop_front();
             if(!(this->ambientSounds_.empty()))
             {
-                this->ambientSounds_.front()->replay();
+                this->fadeInList_.push_front(std::make_pair(this->ambientSounds_.front(), 0.0));
             }
         }
         else
         {
-            for(std::list<BaseSound*>::iterator it= this->ambientSounds_.begin(); it != this->ambientSounds_.end(); it++)
+            for(std::list<AmbientSound*>::iterator it= this->ambientSounds_.begin(); it != this->ambientSounds_.end(); it++)
             {
                 if(*it == currentAmbient)
                 {
+                    currentAmbient->doStop();
                     this->ambientSounds_.erase(it);
                     break;
@@ -158,11 +184,71 @@
     const std::string& SoundManager::getAmbientPath(const std::string& source)
     {
-        lastReqPath = "ambient/" + MoodManager::getInstance().getMood() + "/" + source;
-        shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(lastReqPath);
+        lastReqPath_ = "ambient/" + MoodManager::getInstance().getMood() + "/" + source;
+        shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(lastReqPath_);
         if(fileInfo == NULL)
         {
             return BLANKSTRING;
         }
-        return lastReqPath;
+        return lastReqPath_;
+    }
+
+    void SoundManager::fadeInAmbientSound(float dt)
+    {
+        if(!(this->fadeInList_.empty()))
+        {
+            for(std::list<std::pair<AmbientSound*, float> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
+            {
+                it->second += fadeStep_ * dt;
+                alSourcef(it->first->getALAudioSource(), AL_GAIN, it->second);
+            }
+            if(this->fadeInList_.back().second >= 1)
+            {
+                this->fadeInList_.pop_back();
+            }
+        }
+    }
+
+    void SoundManager::fadeOutAmbientSound(float dt)
+    {
+        if(!(this->fadeInList_.empty()))
+        {
+            for(std::list<std::pair<AmbientSound*, float> >::iterator it= this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
+            {
+                it->second -= fadeStep_ * dt;
+                alSourcef(it->first->getALAudioSource(), AL_GAIN, it->second);
+            }
+            if(this->fadeOutList_.back().second <= 0)
+            {
+                bool pauseTest = false;
+            
+                for(std::list<AmbientSound*>::iterator it= this->ambientSounds_.begin(); it != this->ambientSounds_.end(); it++)
+                {
+                    if(*it == this->fadeOutList_.back().first)
+                    {
+                        pauseTest = true;
+                        break;
+                    }
+                }
+                if(pauseTest)
+                {
+                    this->fadeOutList_.back().first->pause();
+                }
+                else
+                {
+                    this->fadeOutList_.back().first->doStop();
+                }
+                this->fadeOutList_.pop_back();
+            }
+        }
+    }
+
+    void SoundManager::checkFadeStepValidity()
+    {
+        if(fadeStep_ <= 0.0 || fadeStep_ >= 1.0 )
+        {
+            ResetConfigValue(fadeStep_);
+        }
+        COUT(0) << "SoundManager: fade step now set to " << fadeStep_ << std::endl;
+        return;
     }
 }
Index: /code/branches/sound3/src/orxonox/sound/SoundManager.h
===================================================================
--- /code/branches/sound3/src/orxonox/sound/SoundManager.h	(revision 6045)
+++ /code/branches/sound3/src/orxonox/sound/SoundManager.h	(revision 6046)
@@ -42,5 +42,5 @@
      *
      */
-    class _OrxonoxExport SoundManager : public Singleton<SoundManager>
+    class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public OrxonoxClass
     {
         friend class Singleton<SoundManager>;
@@ -49,15 +49,28 @@
         ~SoundManager();
 
+        void update(const Clock &time);
+        void setConfigValues(void);
+
         void setListenerPosition(const Vector3& position);
         void setListenerOrientation(const Quaternion& orientation);
-        void registerAmbientSound(BaseSound* newAmbient);
-        void unregisterAmbientSound(BaseSound* currentAmbient);
+
+        void registerAmbientSound(AmbientSound* newAmbient);
+        void unregisterAmbientSound(AmbientSound* currentAmbient);
         const std::string& getAmbientPath(const std::string& source);
+        void fadeInAmbientSound(float dt);
+        void fadeOutAmbientSound(float dt);
+        void checkFadeStepValidity(void);
 
     private:
         ALCdevice* device_;
         ALCcontext* context_;
-        std::list<BaseSound*> ambientSounds_;
-        std::string lastReqPath;
+       
+        std::list<AmbientSound*> ambientSounds_;
+        
+        float fadeStep_;       //per second
+        std::list<std::pair<AmbientSound*, float> > fadeInList_;
+        std::list<std::pair<AmbientSound*, float> > fadeOutList_;
+        
+        std::string lastReqPath_;
 
         static SoundManager* singletonPtr_s;
