Index: code/branches/sound3/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/AmbientSound.cc	(revision 6070)
+++ code/branches/sound3/src/orxonox/sound/AmbientSound.cc	(revision 6071)
@@ -32,6 +32,8 @@
 #include "core/EventIncludes.h"
 #include "core/GameMode.h"
+#include "core/Resource.h"
 #include "core/XMLPort.h"
 #include "SoundManager.h"
+#include "MoodManager.h"
 
 namespace orxonox
@@ -56,7 +58,7 @@
         SUPER(AmbientSound, XMLPort, xmlelement, mode);
         XMLPortParamExtern(AmbientSound, BaseSound, this, "volume", setVolume, getVolume, xmlelement, mode);
-        XMLPortParamExtern(AmbientSound, BaseSound, this, "loop", setLoop, getLoop, xmlelement, mode);
-        XMLPortParamExtern(AmbientSound, BaseSound, this, "playOnLoad", setPlayOnLoad, getPlayOnLoad, xmlelement, mode);
-        XMLPortParamExtern(AmbientSound, BaseSound, this, "source", setSource, getSource, xmlelement, mode);
+        XMLPortParamExtern(AmbientSound, BaseSound, this, "loop", setLooping, getLooping, xmlelement, mode);
+        XMLPortParamExtern(AmbientSound, BaseSound, this, "play", play, isPlaying, xmlelement, mode);
+        XMLPortParam(AmbientSound, "source", setAmbientSource, getAmbientSource, xmlelement, mode);
     }
 
@@ -107,15 +109,15 @@
     }
 
-    void AmbientSound::setSource(const std::string& source)
+    void AmbientSound::setAmbientSource(const std::string& source)
     {
+        this->ambientSource_ = source;
         if (GameMode::playsSound())
         {
-            std::string filePath = SoundManager::getInstance().getAmbientPath(source);
-            if (!filePath.empty())
-            {
-                BaseSound::setSource(filePath);
-                return;
-            }
-            COUT(3) << "Sound: " << source << ": Not a valid name! Ambient sound will not change." << std::endl;       
+            std::string path = "ambient/" + MoodManager::getInstance().getMood() + "/" + source;
+            shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
+            if (fileInfo != NULL)
+                this->setSource(path);
+            else
+                COUT(3) << "Sound: " << source << ": Not a valid name! Ambient sound will not change." << std::endl;       
         }
     }
Index: code/branches/sound3/src/orxonox/sound/AmbientSound.h
===================================================================
--- code/branches/sound3/src/orxonox/sound/AmbientSound.h	(revision 6070)
+++ code/branches/sound3/src/orxonox/sound/AmbientSound.h	(revision 6071)
@@ -59,10 +59,13 @@
         virtual void pause();
 
-        virtual void setSource(const std::string& source);
+        virtual void setAmbientSource(const std::string& source);
+        const std::string& getAmbientSource() const { return this->ambientSource_; }
 
     private:
-        void doPlay();      // Continue playing without re-registering the sound
+        void doPlay();
         void doStop();
         void doPause();
+
+        std::string ambientSource_; //!< Analogous to source_, but mood independent
     };
 }
Index: code/branches/sound3/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/BaseSound.cc	(revision 6070)
+++ code/branches/sound3/src/orxonox/sound/BaseSound.cc	(revision 6071)
@@ -29,4 +29,5 @@
 #include "BaseSound.h"
 
+#include <cassert>
 #include <vector>
 #include <AL/alut.h>
@@ -42,11 +43,14 @@
         : audioSource_(0)
         , audioBuffer_(0)
-        , bPlayOnLoad_(false)
         , bLoop_(false)
+        , state_(Stopped)
     {
         RegisterRootObject(BaseSound);
 
         if (GameMode::playsSound())
+        {
             alGenSources(1, &this->audioSource_);
+            assert(this->audioSource_ != 0);
+        }
     }
 
@@ -54,5 +58,5 @@
     {
         this->setSource("");
-        if (this->audioSource_)
+        if (GameMode::playsSound())
             alDeleteSources(1, &this->audioSource_);
     }
@@ -60,16 +64,11 @@
     void BaseSound::play()
     {
-        if (alIsSource(this->audioSource_))
-        {
-            if (this->bLoop_)
-                alSourcei(this->audioSource_, AL_LOOPING, AL_TRUE);
-            else
-                alSourcei(this->audioSource_, AL_LOOPING, AL_FALSE);
+        if (!this->isPlaying() && GameMode::showsGraphics())
+        {
+            this->state_ = Playing;
             alSourcePlay(this->audioSource_);
 
             if (alGetError() != AL_NO_ERROR)
-            {
                  COUT(2) << "Sound: OpenAL: Error playing sound " << this->audioSource_ << std::endl;
-            }
         }
     }
@@ -77,5 +76,6 @@
     void BaseSound::stop()
     {
-        if (alIsSource(this->audioSource_))
+        this->state_ = Stopped;
+        if (GameMode::playsSound())
             alSourceStop(this->audioSource_);
     }
@@ -83,27 +83,9 @@
     void BaseSound::pause()
     {
-        if (alIsSource(this->audioSource_))
+        if (this->isStopped())
+            return;
+        this->state_ = Paused;
+        if (GameMode::playsSound())
             alSourcePause(this->audioSource_);
-    }
-
-    bool BaseSound::isPlaying()
-    {
-        if (alIsSource(this->audioSource_))
-            return getSourceState() == AL_PLAYING;
-        return false;
-    }
-
-    bool BaseSound::isPaused()
-    {
-        if (alIsSource(this->audioSource_))
-            return getSourceState() == AL_PAUSED;
-        return false;
-    }
-
-    bool BaseSound::isStopped()
-    {
-        if (alIsSource(this->audioSource_))
-            return getSourceState() == AL_INITIAL || getSourceState() == AL_STOPPED;
-        return true;
     }
 
@@ -121,4 +103,11 @@
     }
 
+    void BaseSound::setLooping(bool val)
+    {
+        this->bLoop_ = val;
+        if (GameMode::playsSound())
+            alSourcei(this->audioSource_, AL_LOOPING, (val ? AL_TRUE : AL_FALSE));
+    }
+
     void BaseSound::setSource(const std::string& source)
     {
@@ -128,8 +117,8 @@
             return;
         }
-        
-        if (alIsSource(this->audioBuffer_))
-        {
-            this->stop();
+
+        if (this->audioBuffer_ != 0 && alIsBuffer(this->audioBuffer_))
+        {
+            alSourceStop(this->audioSource_);
             // Unload old sound first
             alSourcei(this->audioSource_, AL_BUFFER, 0);
@@ -183,16 +172,13 @@
 
         alSource3f(this->audioSource_, AL_POSITION,  0, 0, 0);
-
-        this->setVolume(this->volume_);
-
-        if (this->bPlayOnLoad_)
-            this->play();
-    }
-
-    ALint BaseSound::getSourceState()
-    {
-        ALint state;
-        alGetSourcei(this->audioSource_, AL_SOURCE_STATE, &state);
-        return state;
+        alSourcef (this->audioSource_, AL_GAIN, this->volume_);
+        alSourcei (this->audioSource_, AL_LOOPING, (this->bLoop_ ? AL_TRUE : AL_FALSE));
+        if (this->isPlaying() || this->isPaused())
+            alSourcePlay(this->audioSource_);
+        if (this->isPaused())
+            alSourcePause(this->audioSource_);
+
+        if (alGetError() != AL_NO_ERROR)
+            COUT(2) << "Sound: OpenAL: Error playing sound " << this->audioSource_ << std::endl;
     }
 
Index: code/branches/sound3/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/sound3/src/orxonox/sound/BaseSound.h	(revision 6070)
+++ code/branches/sound3/src/orxonox/sound/BaseSound.h	(revision 6071)
@@ -53,7 +53,7 @@
         virtual void pause();
 
-        bool isPlaying();
-        bool isPaused();
-        bool isStopped();
+        bool isPlaying() { return this->state_ = Playing; }
+        bool isPaused()  { return this->state_ = Paused; }
+        bool isStopped() { return this->state_ = Stopped; }
 
         virtual void setSource(const std::string& source);
@@ -63,9 +63,6 @@
         float getVolume() const { return this->volume_; }
 
-        bool getPlayOnLoad() const   { return this->bPlayOnLoad_; }
-        void setPlayOnLoad(bool val) { this->bPlayOnLoad_ = val; }
-
-        bool getLoop() const   { return this->bLoop_; }
-        void setLoop(bool val) { this->bLoop_ = val; }
+        bool getLooping() const   { return this->bLoop_; }
+        void setLooping(bool val);
 
         //ALuint getALAudioSource(void);
@@ -73,5 +70,4 @@
     protected:
         ALuint loadOggFile();
-        ALint getSourceState();
 
         ALuint audioSource_;
@@ -79,8 +75,15 @@
 
     private:
+        enum State
+        {
+            Stopped,
+            Playing,
+            Paused
+        };
+
         std::string     source_;
         float           volume_;
-        bool            bPlayOnLoad_;
         bool            bLoop_;
+        State           state_;
         DataStreamPtr   dataStream_;
     };
Index: code/branches/sound3/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/SoundManager.cc	(revision 6070)
+++ code/branches/sound3/src/orxonox/sound/SoundManager.cc	(revision 6071)
@@ -40,8 +40,6 @@
 #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"
 
@@ -223,16 +221,4 @@
     }
 
-    //! Get the current mood and return the full path string to the requested sound.
-    std::string SoundManager::getAmbientPath(const std::string& source)
-    {
-        std::string path = "ambient/" + MoodManager::getInstance().getMood() + "/" + source;
-        shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
-        if (fileInfo == NULL)
-        {
-            return "";
-        }
-        return path;
-    }
-
     void SoundManager::fadeIn(AmbientSound* sound)
     {
Index: code/branches/sound3/src/orxonox/sound/SoundManager.h
===================================================================
--- code/branches/sound3/src/orxonox/sound/SoundManager.h	(revision 6070)
+++ code/branches/sound3/src/orxonox/sound/SoundManager.h	(revision 6071)
@@ -60,5 +60,4 @@
         void unregisterAmbientSound(AmbientSound* oldAmbient);
         void pauseAmbientSound(AmbientSound* ambient);
-        std::string getAmbientPath(const std::string& source);
 
     private:
Index: code/branches/sound3/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/WorldSound.cc	(revision 6070)
+++ code/branches/sound3/src/orxonox/sound/WorldSound.cc	(revision 6071)
@@ -54,6 +54,6 @@
         SUPER(WorldSound, XMLPort, xmlelement, mode);
         XMLPortParamExtern(WorldSound, BaseSound, this, "volume", setVolume, getVolume, xmlelement, mode);
-        XMLPortParamExtern(WorldSound, BaseSound, this, "loop", setLoop, getLoop, xmlelement, mode);
-        XMLPortParamExtern(WorldSound, BaseSound, this, "playOnLoad", setPlayOnLoad, getPlayOnLoad, xmlelement, mode);
+        XMLPortParamExtern(WorldSound, BaseSound, this, "loop", setLooping, getLooping, xmlelement, mode);
+        XMLPortParamExtern(WorldSound, BaseSound, this, "play", play, isPlaying, xmlelement, mode);
         XMLPortParamExtern(WorldSound, BaseSound, this, "source", setSource, getSource, xmlelement, mode);
     }
