Index: /code/branches/sound/src/sound/SoundBase.cc
===================================================================
--- /code/branches/sound/src/sound/SoundBase.cc	(revision 2930)
+++ /code/branches/sound/src/sound/SoundBase.cc	(revision 2931)
@@ -27,25 +27,94 @@
  */
 
-#include <SoundBase.h>
-#include <SoundManager.h>
-
-#include <Ogre/SceneNode.h>
+#include "orxonox/objects/worldentities/WorldEntity.h"
+#include "util/Math.h"
+#include "SoundManager.h"
+#include "SoundBase.h"
 
 namespace orxonox 
 {
-    SoundBase::SoundBase(Ogre::SceneNode* node)
+    SoundBase::SoundBase(WorldEntity* entity)
     {
         this->source_ = 0;
         this->buffer_ = 0;
-        this->node_ = node;
+        this->entity_ = entity;
 
-        if(SoundBase::soundmanager_s == null)
-            SoundBase::soundmanager_s == SoundManager::instance();
+        if(SoundBase::soundmanager_s == NULL)
+            SoundBase::soundmanager_s = SoundManager::instance();
     }
 
-    void SoundBase::attachToNode(Ogre::ScenceNode* node)
+    void SoundBase::attachToEntity(WorldEntity* entity)
     {
-        this->node_ = node;
+        this->entity_ = entity;
+        this->update();
     }
 
+    void SoundBase::update() {
+        if(alIsSource(this->source_)) {
+            Vector3 pos = this->entity_->getPosition();
+            alSource3f(this->source_, AL_POSITION, pos.x, pos.y, pos.z);
+            ALenum error = alGetError();
+            if(error == AL_INVALID_VALUE)
+                COUT(2) << "OpenAL: Invalid sound position" << std::endl;
+
+            Vector3 vel = this->entity_->getVelocity();
+            alSource3f(this->source_, AL_VELOCITY, vel.x, vel.y, vel.z);
+            error = alGetError();
+            if(error == AL_INVALID_VALUE)
+                COUT(2) << "OpenAL: Invalid sound position" << std::endl;
+
+            Quaternion orient = this->entity_->getOrientation();
+            Vector3 at = orient.zAxis();
+            alSource3f(this->source_, AL_DIRECTION, at.x, at.y, at.z);
+            error = alGetError();
+            if(error == AL_INVALID_VALUE)
+                COUT(2) << "OpenAL: Invalid sound position" << std::endl;
+        }
+    }
+
+    void SoundBase::play(bool loop) {
+        if(alIsSource(this->source_)) {
+            if(loop)
+                alSourcei(this->source_, AL_LOOPING, AL_TRUE);
+            else
+                alSourcei(this->source_, AL_LOOPING, AL_FALSE);
+            alSourcePlay(this->source_);
+        }
+    }
+
+    void SoundBase::stop() {
+        if(alIsSource(this->source_)) {
+            alSourceStop(this->source_);
+        }
+    }
+
+    void SoundBase::pause() {
+        if(alIsSource(this->source_)) {
+            alSourcePause(this->source_);
+        }
+    }
+
+    bool SoundBase::isPlaying() {
+        if(alIsSource(this->source_)) {
+            return getSourceState() == AL_PLAYING;
+        }
+    }
+
+    bool SoundBase::isPaused() {
+        if(alIsSource(this->source_)) {
+            return getSourceState() == AL_PAUSED;
+        }
+    }
+
+    bool SoundBase::isStopped() {
+        if(alIsSource(this->source_)) {
+            return getSourceState() == AL_INITIAL || getSourceState() == AL_STOPPED;
+        }
+    }
+
+    ALint SoundBase::getSourceState() {
+        ALint state;
+        alGetSourcei(this->source_, AL_SOURCE_STATE, &state);
+        return state;
+    }
 } // namespace: orxonox
Index: /code/branches/sound/src/sound/SoundBase.h
===================================================================
--- /code/branches/sound/src/sound/SoundBase.h	(revision 2930)
+++ /code/branches/sound/src/sound/SoundBase.h	(revision 2931)
@@ -32,9 +32,8 @@
 #include <string>
 
-class Ogre::SceneNode;
-class Orxonox::SoundManager;
-
 namespace orxonox
 {
+    class SoundManager;
+    class WorldEntity;
     /**
      * The SoudBase class is the base class for all sound file loader classes.
@@ -45,8 +44,8 @@
     {
     public:
-        SoundBase(Ogre::SceneNode* node);
+        SoundBase(WorldEntity* entity);
         ~SoundBase();
 
-        void attachToNode(Ogre::SceneNode* node);
+        void attachToEntity(WorldEntity* entity);
         void update();
         void play(bool loop);
@@ -55,4 +54,6 @@
 
         bool isPlaying();
+        bool isPaused();
+        bool isStopped();
 
         virtual void loadFile(std::string filename) = 0;
@@ -61,7 +62,9 @@
         ALuint source_;
         ALuint buffer_;
-        Ogre::SceneNode* node_;
+        WorldEntity* entity_;
 
         static SoundManager* soundmanager_s;
+
+        ALint getSourceState();
     }; // class SoundBase
 } // namepsace orxonox
Index: /code/branches/sound/src/sound/SoundManager.cc
===================================================================
--- /code/branches/sound/src/sound/SoundManager.cc	(revision 2930)
+++ /code/branches/sound/src/sound/SoundManager.cc	(revision 2931)
@@ -32,4 +32,5 @@
 #include "orxonox/objects/worldentities/Camera.h"
 #include "util/Math.h"
+#include "SoundBase.h"
 #include "SoundManager.h"
 
@@ -108,5 +109,5 @@
         alListener3f(AL_POSITION, pos.x, pos.y, pos.z);
         ALenum error = alGetError();
-        if(error != AL_INVALID_VALUE)
+        if(error == AL_INVALID_VALUE)
             COUT(2) << "OpenAL: Invalid listener position" << std::endl;
 
@@ -116,5 +117,5 @@
         Vector3 at = orient.zAxis();
 
-        ALfloat* orientation = { at.x, at.y, at.z, 
+        ALfloat orientation[6] = { at.x, at.y, at.z, 
                                  up.x, up.y, up.z };
 
