Index: code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc
===================================================================
--- code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc	(revision 6326)
+++ code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc	(revision 6327)
@@ -56,10 +56,11 @@
         RegisterObject(MultiStateEngine);
 
-        if( GameMode::isMaster() )
+        if (GameMode::isMaster())
         {
             this->defEngineSndNormal_ = new WorldSound(this);
-            this->defEngineSndBoost_ = new WorldSound(this);
+            this->defEngineSndBoost_  = new WorldSound(this);
             this->defEngineSndNormal_->setLooping(true);
             this->defEngineSndBoost_->setLooping(true);
+            this->lua_ = new LuaState();
         }
         else
@@ -67,9 +68,10 @@
             this->defEngineSndBoost_ = 0;
             this->defEngineSndNormal_ = 0;
-        }
-
-        this->lua_ = new LuaState();
+            this->lua_ = 0;
+        }
         this->state_ = 0;
-
+        this->steeringDirectionZ_ = 0;
+
+        this->setSyncMode(ObjectDirection::Bidirectional);
         this->registerVariables();
     }
@@ -77,15 +79,19 @@
     MultiStateEngine::~MultiStateEngine()
     {
-        if (this->isInitialized() && !this->getShip())
-        {
-            // We have no ship, so the effects are not attached and won't be destroyed automatically
-            for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
-                for (std::vector<WorldEntity*>::const_iterator it2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)
-                    (*it2)->destroy();
-            if( this->defEngineSndNormal_ )
-                delete this->defEngineSndNormal_;
-            if( this->defEngineSndBoost_  )
-                delete this->defEngineSndBoost_;
-            delete this->lua_;
+        if (this->isInitialized())
+        {
+            if (!this->getShip())
+            {
+                // We have no ship, so the effects are not attached and won't be destroyed automatically
+                for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
+                    for (std::vector<WorldEntity*>::const_iterator it2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)
+                        (*it2)->destroy();
+                if (this->defEngineSndNormal_)
+                    delete this->defEngineSndNormal_;
+                if (this->defEngineSndBoost_)
+                    delete this->defEngineSndBoost_;
+            }
+            if (this->lua_)
+                delete this->lua_;
         }
     }
@@ -101,5 +107,5 @@
     void MultiStateEngine::registerVariables()
     {
-        registerVariable(this->state_, VariableDirection::ToServer);
+        registerVariable(this->steeringDirectionZ_, VariableDirection::ToServer);
     }
 
@@ -108,14 +114,12 @@
         if (this->getShip())
         {
-//             if (this->getShip()->hasLocalController())
-            if (GameMode::isMaster() && this->getShip()->getController())
+            if (this->getShip()->hasLocalController())
+                this->steeringDirectionZ_ = this->getDirection().z;
+            if (GameMode::isMaster())
             {
-                this->setSyncMode(ObjectDirection::Bidirectional);
-
-                const Vector3& direction = this->getDirection();
                 const Vector3& velocity = this->getShip()->getLocalVelocity();
 
                 float pitch = velocity.length();
-                bool forward = (direction.z < 0 && velocity.z < -FORWARD_EFFECT_VELOCITY_THRESHOLD);
+                bool forward = (this->steeringDirectionZ_ < 0 && velocity.z < -FORWARD_EFFECT_VELOCITY_THRESHOLD);
 
                 int newState = 0;
@@ -123,72 +127,51 @@
                 {
                     newState = Boost;
-                    pitch = pitch/MAX_VELOCITY_BOOST + 1;
-                    pitch = pitch > 2 ? 2 : pitch;
-                    pitch = pitch < 0.5 ? 0.5 : pitch;
-                    defEngineSndBoost_->setPitch(pitch);
+                    defEngineSndBoost_->setPitch(clamp(pitch/MAX_VELOCITY_BOOST + 1, 0.5f, 2.0f));
                 }
                 else if (forward && !newState) // newState == Boost
                 {
                     newState = Normal;
-                    pitch = pitch/MAX_VELOCITY_NORMAL + 1;
-                    pitch = pitch > 2 ? 2 : pitch;
-                    pitch = pitch < 0.5 ? 0.5 : pitch;
-                    defEngineSndNormal_->setPitch(pitch);
-                }
-                else if (direction.z > 0 && velocity.z < 0)
+                    defEngineSndNormal_->setPitch(clamp(pitch/MAX_VELOCITY_NORMAL + 1, 0.5f, 2.0f));
+                }
+                else if (this->steeringDirectionZ_ > 0 && velocity.z < 0)
                     newState = Brake;
                 else
                     newState = Idle;
 
-                if (newState != this->state_)
-                {
-                    int changes = newState | this->state_;
-                    if (changes & Idle)
-                    {
-                        lua_pushboolean(this->lua_->getInternalLuaState(), newState & Idle);
-                        lua_setglobal(this->lua_->getInternalLuaState(), "idle");
-                    }
-                    if (changes & Normal)
-                    {
-                        lua_pushboolean(this->lua_->getInternalLuaState(), newState & Normal);
-                        lua_setglobal(this->lua_->getInternalLuaState(), "normal");
-                        if(newState & Normal)
-                        {
-                            defEngineSndNormal_->play();
-                        }
-                        else
-                        {
-                            defEngineSndNormal_->stop();
-                        }
-                    }
-                    if (changes & Brake)
-                    {
-                        lua_pushboolean(this->lua_->getInternalLuaState(), newState & Brake);
-                        lua_setglobal(this->lua_->getInternalLuaState(), "brake");
-                    }
-                    if (changes & Boost)
-                    {
-                        lua_pushboolean(this->lua_->getInternalLuaState(), newState & Boost);
-                        lua_setglobal(this->lua_->getInternalLuaState(), "boost");
-                        if(newState & Boost)
-                        {
-                            defEngineSndBoost_->play();
-                        }
-                        else
-                        {
-                            defEngineSndBoost_->stop();
-                        }
-                    }
-
-                    // Update all effect conditions
-                    for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
-                        (*it)->updateCondition();
-
-                    this->state_ = newState;
-                }
-            }
-
-            if (GameMode::isMaster())
-            {
+                int changes = newState | this->state_;
+                if (changes & Idle)
+                {
+                    lua_pushboolean(this->lua_->getInternalLuaState(), newState & Idle);
+                    lua_setglobal(this->lua_->getInternalLuaState(), "idle");
+                }
+                if (changes & Normal)
+                {
+                    lua_pushboolean(this->lua_->getInternalLuaState(), newState & Normal);
+                    lua_setglobal(this->lua_->getInternalLuaState(), "normal");
+                    if (newState & Normal)
+                        defEngineSndNormal_->play();
+                    else
+                        defEngineSndNormal_->stop();
+                }
+                if (changes & Brake)
+                {
+                    lua_pushboolean(this->lua_->getInternalLuaState(), newState & Brake);
+                    lua_setglobal(this->lua_->getInternalLuaState(), "brake");
+                }
+                if (changes & Boost)
+                {
+                    lua_pushboolean(this->lua_->getInternalLuaState(), newState & Boost);
+                    lua_setglobal(this->lua_->getInternalLuaState(), "boost");
+                    if (newState & Boost)
+                        defEngineSndBoost_->play();
+                    else
+                        defEngineSndBoost_->stop();
+                }
+
+                this->state_ = newState;
+
+                // Update all effect conditions
+                for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
+                    (*it)->updateCondition();
             }
         }
Index: code/branches/presentation2/src/orxonox/items/MultiStateEngine.h
===================================================================
--- code/branches/presentation2/src/orxonox/items/MultiStateEngine.h	(revision 6326)
+++ code/branches/presentation2/src/orxonox/items/MultiStateEngine.h	(revision 6327)
@@ -71,4 +71,5 @@
 
         private:
+            int steeringDirectionZ_;
             int state_;
             LuaState* lua_;
Index: code/branches/presentation2/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.cc	(revision 6326)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.cc	(revision 6327)
@@ -200,5 +200,5 @@
     void BaseSound::setSource(const std::string& source)
     {
-        if (!GameMode::playsSound() || source == this->source_) 
+        if (!GameMode::playsSound())
         {
             this->source_ = source;
@@ -208,4 +208,9 @@
         if (this->soundBuffer_ != NULL)
         {
+            if (this->soundBuffer_->getFilename() == source)
+            {
+                assert(this->source_ == source_);
+                return;
+            }
             // Stopping is imperative here!
             if (alIsSource(this->audioSource_))
@@ -248,6 +253,5 @@
     void BaseSound::stateChanged()
     {
-        CCOUT(0) << "changed state to " << this->state_ << endl;
-        switch( this->state_ )
+        switch (this->state_)
         {
             case Playing:
