Index: /trunk/src/lib/sound/ogg_player.cc
===================================================================
--- /trunk/src/lib/sound/ogg_player.cc	(revision 7459)
+++ /trunk/src/lib/sound/ogg_player.cc	(revision 7460)
@@ -32,472 +32,474 @@
 #include "debug.h"
 
-/**
- * initializes an Ogg-player from a file
- * @param fileName the file to load
- */
-OggPlayer::OggPlayer(const std::string& fileName)
+namespace OrxSound
 {
-  this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");
-
-  this->state = OggPlayer::None;
-
-  this->source = 0;
-  this->buffers[0] = 0;
-  this->buffers[1] = 0;
-  this->musicThreadID = NULL;
-  this->musicMutex = SDL_CreateMutex();
-
-  if (!fileName.empty())
-  {
-    if (this->open(fileName))
-      this->setName(fileName);
-  }
-
-}
-
-/**
- * @brief deletes the OggPlayer
- */
-OggPlayer::~OggPlayer()
-{
-  this->release();
-  SDL_DestroyMutex(this->musicMutex);
-}
-
-///////////////
-// INTERFACE //
-///////////////
-/**
- * @brief opens a file for playback
- * @param fileName the file to open
- */
-bool OggPlayer::open(const std::string& fileName)
-{
-  MutexLock(this->musicMutex);
-  // release old Ogg-File (if loaded)
-  if (this->state & OggPlayer::FileOpened)
-    this->release();
-
-  // allocating Buffers
-  if (this->buffers[0] == 0)
-    alGenBuffers(2, this->buffers);
-  SoundEngine::checkError("Allocating Buffers", __LINE__);
-  if (this->buffers[0] != 0 && this->buffers[1] != 0)
-    state |= OggPlayer::BuffersAllocated;
-  else
-  {
-    PRINTF(2)("Unable to allocate al-Buffers\n");
-    this->release();
-    return false;
-  }
-  // allocating source
-  if (this->source == 0)
-    SoundEngine::getInstance()->popALSource(this->source);
-  if (this->source != 0)
-    state |= OggPlayer::SourceAllocated;
-  else
-  {
-    PRINTF(2)("No more Sources Availiable (maybe you should consider raising the source-count.)\n");
-    this->release();
-    return false;
-  }
-
-  // opening the FILE;
-  int result;
-  if(!(oggFile = fopen(fileName.c_str(), "rb")))
-  {
-    PRINTF(2)("Could not open Ogg file.");
-    this->release();
-    return false;
-  }
-  // reading the Stream.
-  if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
-  {
-    PRINTF(2)("Could not open Ogg stream. %s", getVorbisError(result));
-    fclose(oggFile);
-    this->release();
-    return false;
-  }
-  this->state |= OggPlayer::FileOpened;
-
-  // acquiring the vorbis-properties.
-  vorbisInfo = ov_info(&oggStream, -1);
-  vorbisComment = ov_comment(&oggStream, -1);
-
-  if(vorbisInfo->channels == 1)
-    format = AL_FORMAT_MONO16;
-  else
-    format = AL_FORMAT_STEREO16;
-
-  // setting the Source Properties.
-  alSource3f(source, AL_POSITION,        0.0, 0.0, 0.0);
-  alSource3f(source, AL_VELOCITY,        0.0, 0.0, 0.0);
-  alSource3f(source, AL_DIRECTION,       0.0, 0.0, 0.0);
-  alSourcef (source, AL_ROLLOFF_FACTOR,  0.0          );
-  alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE      );
-  alSourcef (source, AL_GAIN,            SoundEngine::getInstance()->getMusicVolume());
-  SoundEngine::checkError("OggPlayer::open()::SetSourceProperties", __LINE__);
-
-  // Set to State Stopped
-  this->state |= OggPlayer::Stopped;
-  return true;
-}
-
-
-/**
- * @brief start Playing Music.
- * @returns true on success false otherwise.
- */
-bool OggPlayer::play()
-{
-  if (!(this->state & OggPlayer::FileOpened))
-    return false;
-
-  this->state &= ~(OggPlayer::Stopped | OggPlayer::Paused);
-
-  if (!this->playback())
-    return false;
-
-  if (this->musicThreadID == NULL)
-    return ((this->musicThreadID = SDL_CreateThread(OggPlayer::musicThread, (void*)this)) != NULL);
-  return true;
-}
-
-/**
- * @brief stop the OggPlayer from Playing.
- */
-void OggPlayer::stop()
-{
-  this->state &= ~(OggPlayer::Playing | OggPlayer::Paused);
-  this->state |= OggPlayer::Stopped;
-
-  this->suspend();
-  this->rewind();
-}
-
-/**
- * @brief Pause the Playing.
- */
-void OggPlayer::pause()
-{
-  this->state &= ~OggPlayer::Playing;
-
-  if (!(this->state & OggPlayer::Stopped))
-    this->state |= OggPlayer::Paused;
-
-  this->suspend();
-}
-
-/**
- * @brief rewind to the beginning, and play (if already playing)
- */
-void OggPlayer::rewind()
-{
-  this->jumpTo(0.0f);
-}
-
-/**
- * @brief jump to Second timeCode in the MusicFile
- * @param timeCode where to jump to.
- */
-void OggPlayer::jumpTo(float timeCode)
-{
-
-  if (this->state & OggPlayer::FileOpened)
-  {
-    SDL_mutexP(this->musicMutex);
-    ov_time_seek(&this->oggStream, timeCode);
-    SDL_mutexV(this->musicMutex);
-  }
-}
-
-/**
- * @returns the Length of the Music in Seconds
- */
-float OggPlayer::length()
-{
-  if (this->state & OggPlayer::FileOpened)
-    return ov_time_total(&this->oggStream, -1);
-  else
-    return 0.0f;
-}
-
-
-/**
- * @returns true if the file is playing
- */
-bool OggPlayer::isPlaying()
-{
-  if (!(this->state & OggPlayer::FileOpened))
-    return false;
-  ALenum state;
-
-  alGetSourcei(this->source, AL_SOURCE_STATE, &state);
-
-  return (state == AL_PLAYING);
-}
-
-
-
-////////////////////////
-// INTERNAL FUNCTIONS //
-////////////////////////
-/**
- * @brief creates a Thread for Playing back the music even if the rest of the Engine is slow
- * @param oggPlayer the OggPlayer to play back
- * @returns -1 on error.
- */
-int OggPlayer::musicThread(void* oggPlayer)
-{
-  if (oggPlayer == NULL)
-    return -1;
-  OggPlayer* ogg = (OggPlayer*)oggPlayer;
-
-  PRINTF(4)("STARTIG AUDIO THREAD\n");
-  while (ogg->state & OggPlayer::Playing)
-  {
-    SDL_mutexP(ogg->musicMutex);
-    ogg->update();
-    SDL_mutexV(ogg->musicMutex);
-    SDL_Delay(1);
-  }
-  PRINTF(4)("End the AudioThread\n");
-}
-
-
-/**
- * @brief plays back the sound
- * @return true if running, false otherwise
- */
-bool OggPlayer::playback()
-{
-  if (!(this->state & OggPlayer::FileOpened))
-    return false;
-
-  if(this->state & OggPlayer::Playing)
-    return true;
-  this->state |= OggPlayer::Playing;
-
-  SDL_mutexP(this->musicMutex);
-  if(!this->stream(this->buffers[0]) || !this->stream(this->buffers[1]))
-  {
-    SDL_mutexV(this->musicMutex);
-    this->state &= ~OggPlayer::Playing;
-    return false;
-  }
-
-  alSourceQueueBuffers(this->source, 2, this->buffers);
-  if (DEBUG >= 3)
-    SoundEngine::checkError("OggPlayer::playback()::alSourceQueueBuffers", __LINE__);
-
-  alSourcePlay(this->source);
-  if (DEBUG >= 3)
-    SoundEngine::checkError("OggPlayer::playback()::alSourcePlay", __LINE__);
-  SDL_mutexV(this->musicMutex);
-  return true;
-}
-
-
-/**
- * @brief waits for the AudioThread to be finished.
- */
-void OggPlayer::suspend()
-{
-  if (this->musicThreadID != NULL)
-  {
-    assert (!(this->state & Playing));
-    SDL_WaitThread(this->musicThreadID, NULL);
-    this->musicThreadID = NULL;
-  }
-  if (this->state & OggPlayer::SourceAllocated)
-  {
-    alSourceStop(this->source);
-    alSourcei(this->source, AL_BUFFER, 0);
-  }
-}
-
-/**
- * @brief updates the stream, this has to be done every few parts of a second, for sound-consistency
- * @returns true, if the Sound is playing flawlessly
- */
-bool OggPlayer::update()
-{
-  int processed = 0;
-  bool active = true;
-
-  alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
-  if (DEBUG >= 3)
-    SoundEngine::checkError("OggPlayer::update()::alGetSourceI", __LINE__);
-
-  while(processed--)
-  {
-    ALuint buffer;
-
-    alSourceUnqueueBuffers(source, 1, &buffer);
-    if (DEBUG >= 3)
-      SoundEngine::checkError("OggPlayer::update()::unqueue", __LINE__);
-
-    active = stream(buffer);
-
-    alSourceQueueBuffers(source, 1, &buffer);
-    if (DEBUG >= 3)
-      SoundEngine::checkError("OggPlayer::update()::queue", __LINE__);
-  }
-
-  return active;
-}
-
-/**
- * @brief gets a new Stream from buffer
- * @param buffer the buffer to get the stream from
- * @return true, if everything worked as planed
- */
-bool OggPlayer::stream(ALuint buffer)
-{
-  if (unlikely(!(this->state & Playing)))
-    return false;
-  char pcm[OGG_PLAYER_BUFFER_SIZE];
-  int  size = 0;
-  int  section;
-  int  result;
-
-  while(size < OGG_PLAYER_BUFFER_SIZE)
-  {
-    result = ov_read(&this->oggStream, pcm + size, OGG_PLAYER_BUFFER_SIZE - size, 0, 2, 1, &section);
-
-    if(result > 0)
-      size += result;
-    else if(result < 0)
-      throw getVorbisError(result);
-    else /* eof */
-      ov_time_seek(&this->oggStream, 0.0);
-  }
-
-  if(size == 0)
-    return false;
-
-  alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
-  if (DEBUG >= 3)
-    SoundEngine::checkError("OggPlayer::stream()::BUFFER", __LINE__);
-
-  return true;
-}
-
-
-/**
- * @brief releases a stream
- */
-void OggPlayer::release()
-{
-  if (this->state & OggPlayer::SourceAllocated)
-  {
-    assert(alIsSource(this->source));
-    if (this->state & OggPlayer::Playing);
-    {
-      // Kill the Music Thread.
-      this->state &= ~OggPlayer::Playing;
-      this->suspend();
-
-      SoundEngine::checkError("OggPlayer::release()::alSourceStop", __LINE__);
-    }
-    empty();
-    alSourcei(this->source, AL_BUFFER, 0);
-    SoundEngine::getInstance()->pushALSource(this->source);
+  /**
+   * initializes an Ogg-player from a file
+   * @param fileName the file to load
+   */
+  OggPlayer::OggPlayer(const std::string& fileName)
+  {
+    this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");
+
+    this->state = OggPlayer::None;
+
     this->source = 0;
-    this->state &= ~SourceAllocated;
-  }
-  if (this->state & OggPlayer::BuffersAllocated)
-  {
-    assert (this->buffers[0] != 0 && this->buffers[1] != 0);
-    alDeleteBuffers(2, buffers);
-    SoundEngine::checkError("OggPlayer::release()::alDeleteBuffers", __LINE__);
     this->buffers[0] = 0;
     this->buffers[1] = 0;
-    this->state &= ~OggPlayer::BuffersAllocated;
-  }
-
-  if (this->state & OggPlayer::FileOpened)
-  {
-    ov_clear(&oggStream);
-    this->state &= ~OggPlayer::FileOpened;
-  }
-
-}
-
-
-/**
- * @brief empties the buffers
- */
-void OggPlayer::empty()
-{
-  int queued;
-
-  alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
-
-  while(queued--)
-  {
-    ALuint buffer;
-
-    alSourceUnqueueBuffers(source, 1, &buffer);
-    SoundEngine::checkError("OggPlayer::empty()::unqueue Buffers", __LINE__);
-  }
-}
-
-
-/////////////////////
-// DEBUG FUNCTIONS //
-/////////////////////
-/**
- * displays some info about the ogg-file
- */
-void OggPlayer::debug() const
-{
-  cout
-  << "version         " << vorbisInfo->version         << "\n"
-  << "channels        " << vorbisInfo->channels        << "\n"
-  << "rate (hz)       " << vorbisInfo->rate            << "\n"
-  << "bitrate upper   " << vorbisInfo->bitrate_upper   << "\n"
-  << "bitrate nominal " << vorbisInfo->bitrate_nominal << "\n"
-  << "bitrate lower   " << vorbisInfo->bitrate_lower   << "\n"
-  << "bitrate window  " << vorbisInfo->bitrate_window  << "\n"
-  << "\n"
-  << "vendor " << vorbisComment->vendor << "\n";
-
-  for(int i = 0; i < vorbisComment->comments; i++)
-    cout << "   " << vorbisComment->user_comments[i] << "\n";
-
-  cout << endl;
-}
-
-
-void OggPlayer::printState() const
-{
-  PRINTF(0)("OggPlayer is in the following States: ");
-  if (this->state & OggPlayer::FileOpened)
-    PRINT(0)("FileOpened ");
-  if (this->state & OggPlayer::SourceAllocated)
-    PRINT(0)("SourceAllocated ");
-  if (this->state & OggPlayer::BuffersAllocated)
-    PRINT(0)("BuffersAllocated ");
-  if (this->state & OggPlayer::Stopped)
-    PRINT(0)("Stopped ");
-  if (this->state & OggPlayer::Playing)
-    PRINT(0)("Playing ");
-  if (this->state & OggPlayer::Paused)
-    PRINT(0)("Paused ");
-  if (this->state & OggPlayer::Error)
-    PRINT(0)("Error ");
-  PRINT(0)("\n");
-}
-
-/**
- * returns errors
- * @param code the error-code
- * @return the error as a String
- */
-const char* OggPlayer::getVorbisError(int code)
-{
-  switch(code)
-  {
+    this->musicThreadID = NULL;
+    this->musicMutex = SDL_CreateMutex();
+
+    if (!fileName.empty())
+    {
+      if (this->open(fileName))
+        this->setName(fileName);
+    }
+
+  }
+
+  /**
+   * @brief deletes the OggPlayer
+   */
+  OggPlayer::~OggPlayer()
+  {
+    this->release();
+    SDL_DestroyMutex(this->musicMutex);
+  }
+
+  ///////////////
+  // INTERFACE //
+  ///////////////
+  /**
+   * @brief opens a file for playback
+   * @param fileName the file to open
+   */
+  bool OggPlayer::open(const std::string& fileName)
+  {
+    MutexLock(this->musicMutex);
+    // release old Ogg-File (if loaded)
+    if (this->state & OggPlayer::FileOpened)
+      this->release();
+
+    // allocating Buffers
+    if (this->buffers[0] == 0)
+      alGenBuffers(2, this->buffers);
+    SoundEngine::checkError("Allocating Buffers", __LINE__);
+    if (this->buffers[0] != 0 && this->buffers[1] != 0)
+      state |= OggPlayer::BuffersAllocated;
+    else
+    {
+      PRINTF(2)("Unable to allocate al-Buffers\n");
+      this->release();
+      return false;
+    }
+    // allocating source
+    if (this->source == 0)
+      SoundEngine::getInstance()->popALSource(this->source);
+    if (this->source != 0)
+      state |= OggPlayer::SourceAllocated;
+    else
+    {
+      PRINTF(2)("No more Sources Availiable (maybe you should consider raising the source-count.)\n");
+      this->release();
+      return false;
+    }
+
+    // opening the FILE;
+    int result;
+    if(!(oggFile = fopen(fileName.c_str(), "rb")))
+    {
+      PRINTF(2)("Could not open Ogg file.");
+      this->release();
+      return false;
+    }
+    // reading the Stream.
+    if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
+    {
+      PRINTF(2)("Could not open Ogg stream. %s", getVorbisError(result));
+      fclose(oggFile);
+      this->release();
+      return false;
+    }
+    this->state |= OggPlayer::FileOpened;
+
+    // acquiring the vorbis-properties.
+    vorbisInfo = ov_info(&oggStream, -1);
+    vorbisComment = ov_comment(&oggStream, -1);
+
+    if(vorbisInfo->channels == 1)
+      format = AL_FORMAT_MONO16;
+    else
+      format = AL_FORMAT_STEREO16;
+
+    // setting the Source Properties.
+    alSource3f(source, AL_POSITION,        0.0, 0.0, 0.0);
+    alSource3f(source, AL_VELOCITY,        0.0, 0.0, 0.0);
+    alSource3f(source, AL_DIRECTION,       0.0, 0.0, 0.0);
+    alSourcef (source, AL_ROLLOFF_FACTOR,  0.0          );
+    alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE      );
+    alSourcef (source, AL_GAIN,            SoundEngine::getInstance()->getMusicVolume());
+    SoundEngine::checkError("OggPlayer::open()::SetSourceProperties", __LINE__);
+
+    // Set to State Stopped
+    this->state |= OggPlayer::Stopped;
+    return true;
+  }
+
+
+  /**
+   * @brief start Playing Music.
+   * @returns true on success false otherwise.
+   */
+  bool OggPlayer::play()
+  {
+    if (!(this->state & OggPlayer::FileOpened))
+      return false;
+
+    this->state &= ~(OggPlayer::Stopped | OggPlayer::Paused);
+
+    if (!this->playback())
+      return false;
+
+    if (this->musicThreadID == NULL)
+      return ((this->musicThreadID = SDL_CreateThread(OggPlayer::musicThread, (void*)this)) != NULL);
+    return true;
+  }
+
+  /**
+   * @brief stop the OggPlayer from Playing.
+   */
+  void OggPlayer::stop()
+  {
+    this->state &= ~(OggPlayer::Playing | OggPlayer::Paused);
+    this->state |= OggPlayer::Stopped;
+
+    this->suspend();
+    this->rewind();
+  }
+
+  /**
+   * @brief Pause the Playing.
+   */
+  void OggPlayer::pause()
+  {
+    this->state &= ~OggPlayer::Playing;
+
+    if (!(this->state & OggPlayer::Stopped))
+      this->state |= OggPlayer::Paused;
+
+    this->suspend();
+  }
+
+  /**
+   * @brief rewind to the beginning, and play (if already playing)
+   */
+  void OggPlayer::rewind()
+  {
+    this->jumpTo(0.0f);
+  }
+
+  /**
+   * @brief jump to Second timeCode in the MusicFile
+   * @param timeCode where to jump to.
+   */
+  void OggPlayer::jumpTo(float timeCode)
+  {
+
+    if (this->state & OggPlayer::FileOpened)
+    {
+      SDL_mutexP(this->musicMutex);
+      ov_time_seek(&this->oggStream, timeCode);
+      SDL_mutexV(this->musicMutex);
+    }
+  }
+
+  /**
+   * @returns the Length of the Music in Seconds
+   */
+  float OggPlayer::length()
+  {
+    if (this->state & OggPlayer::FileOpened)
+      return ov_time_total(&this->oggStream, -1);
+    else
+      return 0.0f;
+  }
+
+
+  /**
+   * @returns true if the file is playing
+   */
+  bool OggPlayer::isPlaying()
+  {
+    if (!(this->state & OggPlayer::FileOpened))
+      return false;
+    ALenum state;
+
+    alGetSourcei(this->source, AL_SOURCE_STATE, &state);
+
+    return (state == AL_PLAYING);
+  }
+
+
+
+  ////////////////////////
+  // INTERNAL FUNCTIONS //
+  ////////////////////////
+  /**
+   * @brief creates a Thread for Playing back the music even if the rest of the Engine is slow
+   * @param oggPlayer the OggPlayer to play back
+   * @returns -1 on error.
+   */
+  int OggPlayer::musicThread(void* oggPlayer)
+  {
+    if (oggPlayer == NULL)
+      return -1;
+    OggPlayer* ogg = (OggPlayer*)oggPlayer;
+
+    PRINTF(4)("STARTIG AUDIO THREAD\n");
+    while (ogg->state & OggPlayer::Playing)
+    {
+      SDL_mutexP(ogg->musicMutex);
+      ogg->update();
+      SDL_mutexV(ogg->musicMutex);
+      SDL_Delay(1);
+    }
+    PRINTF(4)("End the AudioThread\n");
+  }
+
+
+  /**
+   * @brief plays back the sound
+   * @return true if running, false otherwise
+   */
+  bool OggPlayer::playback()
+  {
+    if (!(this->state & OggPlayer::FileOpened))
+      return false;
+
+    if(this->state & OggPlayer::Playing)
+      return true;
+    this->state |= OggPlayer::Playing;
+
+    SDL_mutexP(this->musicMutex);
+    if(!this->stream(this->buffers[0]) || !this->stream(this->buffers[1]))
+    {
+      SDL_mutexV(this->musicMutex);
+      this->state &= ~OggPlayer::Playing;
+      return false;
+    }
+
+    alSourceQueueBuffers(this->source, 2, this->buffers);
+    if (DEBUG >= 3)
+      SoundEngine::checkError("OggPlayer::playback()::alSourceQueueBuffers", __LINE__);
+
+    alSourcePlay(this->source);
+    if (DEBUG >= 3)
+      SoundEngine::checkError("OggPlayer::playback()::alSourcePlay", __LINE__);
+    SDL_mutexV(this->musicMutex);
+    return true;
+  }
+
+
+  /**
+   * @brief waits for the AudioThread to be finished.
+   */
+  void OggPlayer::suspend()
+  {
+    if (this->musicThreadID != NULL)
+    {
+      assert (!(this->state & Playing));
+      SDL_WaitThread(this->musicThreadID, NULL);
+      this->musicThreadID = NULL;
+    }
+    if (this->state & OggPlayer::SourceAllocated)
+    {
+      alSourceStop(this->source);
+      alSourcei(this->source, AL_BUFFER, 0);
+    }
+  }
+
+  /**
+   * @brief updates the stream, this has to be done every few parts of a second, for sound-consistency
+   * @returns true, if the Sound is playing flawlessly
+   */
+  bool OggPlayer::update()
+  {
+    int processed = 0;
+    bool active = true;
+
+    alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
+    if (DEBUG >= 3)
+      SoundEngine::checkError("OggPlayer::update()::alGetSourceI", __LINE__);
+
+    while(processed--)
+    {
+      ALuint buffer;
+
+      alSourceUnqueueBuffers(source, 1, &buffer);
+      if (DEBUG >= 3)
+        SoundEngine::checkError("OggPlayer::update()::unqueue", __LINE__);
+
+      active = stream(buffer);
+
+      alSourceQueueBuffers(source, 1, &buffer);
+      if (DEBUG >= 3)
+        SoundEngine::checkError("OggPlayer::update()::queue", __LINE__);
+    }
+
+    return active;
+  }
+
+  /**
+   * @brief gets a new Stream from buffer
+   * @param buffer the buffer to get the stream from
+   * @return true, if everything worked as planed
+   */
+  bool OggPlayer::stream(ALuint buffer)
+  {
+    if (unlikely(!(this->state & Playing)))
+      return false;
+    char pcm[OGG_PLAYER_BUFFER_SIZE];
+    int  size = 0;
+    int  section;
+    int  result;
+
+    while(size < OGG_PLAYER_BUFFER_SIZE)
+    {
+      result = ov_read(&this->oggStream, pcm + size, OGG_PLAYER_BUFFER_SIZE - size, 0, 2, 1, &section);
+
+      if(result > 0)
+        size += result;
+      else if(result < 0)
+        throw getVorbisError(result);
+      else /* eof */
+        ov_time_seek(&this->oggStream, 0.0);
+    }
+
+    if(size == 0)
+      return false;
+
+    alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
+    if (DEBUG >= 3)
+      SoundEngine::checkError("OggPlayer::stream()::BUFFER", __LINE__);
+
+    return true;
+  }
+
+
+  /**
+   * @brief releases a stream
+   */
+  void OggPlayer::release()
+  {
+    if (this->state & OggPlayer::SourceAllocated)
+    {
+      assert(alIsSource(this->source));
+      if (this->state & OggPlayer::Playing);
+      {
+        // Kill the Music Thread.
+        this->state &= ~OggPlayer::Playing;
+        this->suspend();
+
+        SoundEngine::checkError("OggPlayer::release()::alSourceStop", __LINE__);
+      }
+      empty();
+      alSourcei(this->source, AL_BUFFER, 0);
+      SoundEngine::getInstance()->pushALSource(this->source);
+      this->source = 0;
+      this->state &= ~SourceAllocated;
+    }
+    if (this->state & OggPlayer::BuffersAllocated)
+    {
+      assert (this->buffers[0] != 0 && this->buffers[1] != 0);
+      alDeleteBuffers(2, buffers);
+      SoundEngine::checkError("OggPlayer::release()::alDeleteBuffers", __LINE__);
+      this->buffers[0] = 0;
+      this->buffers[1] = 0;
+      this->state &= ~OggPlayer::BuffersAllocated;
+    }
+
+    if (this->state & OggPlayer::FileOpened)
+    {
+      ov_clear(&oggStream);
+      this->state &= ~OggPlayer::FileOpened;
+    }
+
+  }
+
+
+  /**
+   * @brief empties the buffers
+   */
+  void OggPlayer::empty()
+  {
+    int queued;
+
+    alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
+
+    while(queued--)
+    {
+      ALuint buffer;
+
+      alSourceUnqueueBuffers(source, 1, &buffer);
+      SoundEngine::checkError("OggPlayer::empty()::unqueue Buffers", __LINE__);
+    }
+  }
+
+
+  /////////////////////
+  // DEBUG FUNCTIONS //
+  /////////////////////
+  /**
+   * displays some info about the ogg-file
+   */
+  void OggPlayer::debug() const
+  {
+    std::cout
+    << "version         " << vorbisInfo->version         << "\n"
+    << "channels        " << vorbisInfo->channels        << "\n"
+    << "rate (hz)       " << vorbisInfo->rate            << "\n"
+    << "bitrate upper   " << vorbisInfo->bitrate_upper   << "\n"
+    << "bitrate nominal " << vorbisInfo->bitrate_nominal << "\n"
+    << "bitrate lower   " << vorbisInfo->bitrate_lower   << "\n"
+    << "bitrate window  " << vorbisInfo->bitrate_window  << "\n"
+    << "\n"
+    << "vendor " << vorbisComment->vendor << "\n";
+
+    for(int i = 0; i < vorbisComment->comments; i++)
+      std::cout << "   " << vorbisComment->user_comments[i] << "\n";
+
+    std::cout << std::endl;
+  }
+
+
+  void OggPlayer::printState() const
+  {
+    PRINTF(0)("OggPlayer is in the following States: ");
+    if (this->state & OggPlayer::FileOpened)
+      PRINT(0)("FileOpened ");
+    if (this->state & OggPlayer::SourceAllocated)
+      PRINT(0)("SourceAllocated ");
+    if (this->state & OggPlayer::BuffersAllocated)
+      PRINT(0)("BuffersAllocated ");
+    if (this->state & OggPlayer::Stopped)
+      PRINT(0)("Stopped ");
+    if (this->state & OggPlayer::Playing)
+      PRINT(0)("Playing ");
+    if (this->state & OggPlayer::Paused)
+      PRINT(0)("Paused ");
+    if (this->state & OggPlayer::Error)
+      PRINT(0)("Error ");
+    PRINT(0)("\n");
+  }
+
+  /**
+   * returns errors
+   * @param code the error-code
+   * @return the error as a String
+   */
+  const char* OggPlayer::getVorbisError(int code)
+  {
+    switch(code)
+    {
     case OV_EREAD:
       return ("Read from media.");
@@ -512,5 +514,6 @@
     default:
       return ("Unknown Ogg error.");
-  }
+    }
+  }
+
 }
-
Index: /trunk/src/lib/sound/ogg_player.h
===================================================================
--- /trunk/src/lib/sound/ogg_player.h	(revision 7459)
+++ /trunk/src/lib/sound/ogg_player.h	(revision 7460)
@@ -7,6 +7,4 @@
 #ifndef _OGG_PLAYER_H
 #define _OGG_PLAYER_H
-
-using namespace std;
 
 #include "base_object.h"
@@ -22,73 +20,74 @@
 #define OGG_PLAYER_BUFFER_SIZE (8096 * 2)
 
+namespace OrxSound
+{
+  // the definition of a Ogg-Player
+  class OggPlayer : public BaseObject
+  {
+  public:
+    /**
+     * An enumerator defining in what State the OggPlayer is.
+     * The OggPlayer can be in multiple States listed here.
+     * It can as an example be in FileOpened and Stopped.
+     */
+    typedef enum {
+      None                   = 0x000,   //!< Initialized
+      FileOpened             = 0x100,   //!< File is Opened
+      SourceAllocated        = 0x200,   //!< Source is Allocated.
+      BuffersAllocated       = 0x400,   //!< 2 Buffers are Allocated.
+      Stopped                = 0x010,   //!< OggPlayer is stopped.
+      Playing                = 0x020,   //!< OggPlayer is Playing.
+      Paused                 = 0x040,   //!< OggPlayer is Paused.
+      Error                  = 0x001,   //!< An Error has occured.
+    } State;
 
-// the definition of a Ogg-Player
-class OggPlayer : public BaseObject
-{
-public:
-  /**
-   * An enumerator defining in what State the OggPlayer is.
-   * The OggPlayer can be in multiple States listed here.
-   * It can as an example be in FileOpened and Stopped.
-   */
-  typedef enum {
-    None                   = 0x000,   //!< Initialized
-    FileOpened             = 0x100,   //!< File is Opened
-    SourceAllocated        = 0x200,   //!< Source is Allocated.
-    BuffersAllocated       = 0x400,   //!< 2 Buffers are Allocated.
-    Stopped                = 0x010,   //!< OggPlayer is stopped.
-    Playing                = 0x020,   //!< OggPlayer is Playing.
-    Paused                 = 0x040,   //!< OggPlayer is Paused.
-    Error                  = 0x001,   //!< An Error has occured.
-  } State;
+    OggPlayer(const std::string& fileName = "");
+    virtual ~OggPlayer();
+    /** @param state compare this State with the internal State @returns true on match */
+    bool operator==(OggPlayer::State state) { return this->state & state; };
 
-  OggPlayer(const std::string& fileName = "");
-  virtual ~OggPlayer();
-  /** @param state compare this State with the internal State @returns true on match */
-  bool operator==(OggPlayer::State state) { return this->state & state; };
+    bool open(const std::string& fileName = "");
 
-  bool open(const std::string& fileName = "");
+    bool play();
+    void stop();
+    void pause();
+    void rewind(); // convenience
+    void jumpTo(float timeCode);
 
-  bool play();
-  void stop();
-  void pause();
-  void rewind(); // convenience
-  void jumpTo(float timeCode);
+    float length();
+    bool isPlaying();
+    bool getState() { return this->state; };
 
-  float length();
-  bool isPlaying();
-  bool getState() { return this->state; };
-
-  void debug() const;
-  void printState() const;
-  const char* getVorbisError(int code);
+    void debug() const;
+    void printState() const;
+    const char* getVorbisError(int code);
 
 
-private:
-  static int musicThread(void* oggPlayer);
-  bool playback();
-  void suspend();
-  bool update();
+  private:
+    static int musicThread(void* oggPlayer);
+    bool playback();
+    void suspend();
+    bool update();
 
-  void release();
+    void release();
 
-  bool stream(ALuint buffer);
-  void empty();
+    bool stream(ALuint buffer);
+    void empty();
 
-private:
-  FILE*               oggFile;              //!< general file-handler, to open the sound-file
-  OggVorbis_File      oggStream;            //!< The stream this Ogg-player is playing back
-  vorbis_info*        vorbisInfo;           //!< The information held in the opened ogg-file
-  vorbis_comment*     vorbisComment;        //!< Comments about the ogg-file
+  private:
+    FILE*               oggFile;              //!< general file-handler, to open the sound-file
+    OggVorbis_File      oggStream;            //!< The stream this Ogg-player is playing back
+    vorbis_info*        vorbisInfo;           //!< The information held in the opened ogg-file
+    vorbis_comment*     vorbisComment;        //!< Comments about the ogg-file
 
-  ALuint              buffers[2];           //!< buffers that handle sequentially buffering of the audio
-  ALuint              source;               //!< The source we play back on
-  ALenum              format;               //!< The format we play back
-  unsigned int        state;                //!< The States the OggPlayer is in (this can be multiple entries from OggPlayer::State).
+    ALuint              buffers[2];           //!< buffers that handle sequentially buffering of the audio
+    ALuint              source;               //!< The source we play back on
+    ALenum              format;               //!< The format we play back
+    unsigned int        state;                //!< The States the OggPlayer is in (this can be multiple entries from OggPlayer::State).
 
-  SDL_Thread*         musicThreadID;        //!< The Thread in which music is Played back.
-  SDL_mutex*          musicMutex;           //!< A Mutex so that the two threads do not interfere.
-};
+    SDL_Thread*         musicThreadID;        //!< The Thread in which music is Played back.
+    SDL_mutex*          musicMutex;           //!< A Mutex so that the two threads do not interfere.
+  };
 
-
+}
 #endif /* _OGG_PLAYER_H */
Index: /trunk/src/lib/sound/sound_buffer.cc
===================================================================
--- /trunk/src/lib/sound/sound_buffer.cc	(revision 7459)
+++ /trunk/src/lib/sound/sound_buffer.cc	(revision 7460)
@@ -23,80 +23,80 @@
 #include <cassert>
 
-using namespace std;
+namespace OrxSound
+{
+  //////////////////
+  /* SOUND-BUFFER */
+  //////////////////
+  /**
+   *  Creates a Soundbuffer out of an inputfile
+   * @param fileName The name of the File
+   */
+  SoundBuffer::SoundBuffer(const std::string& fileName)
+  {
+    this->setClassID(CL_SOUND_BUFFER, "SoundBuffer");
+    this->setName(fileName);
 
-//////////////////
-/* SOUND-BUFFER */
-//////////////////
-/**
- *  Creates a Soundbuffer out of an inputfile
- * @param fileName The name of the File
- */
-SoundBuffer::SoundBuffer(const std::string& fileName)
-{
-  this->setClassID(CL_SOUND_BUFFER, "SoundBuffer");
-  this->setName(fileName);
-
-  // generate a Buffer
-  alGenBuffers(1, &this->bufferID);
-  SoundEngine::checkError("Generate Buffer", __LINE__);
-  this->loadWAV(fileName);
-}
-
-SoundBuffer::~SoundBuffer()
-{
-  //  SoundEngine::getInstance()->removeBuffer(this);
-  alDeleteBuffers(1, &this->bufferID);
-  SoundEngine::checkError("SoundBuffer: Delete Buffer", __LINE__);
-}
-
-/**
- * @brief loads a Waveform from the local fileSystem into this Source.
- * @param fileName the Name of the File to Load.
- * @returns true on success.
- */
-bool SoundBuffer::loadWAV(const std::string& fileName)
-{
-  SDL_AudioSpec wavSpec;
-  Uint32 wavLength;
-  Uint8 *wavBuffer;
-
-  /* Load the WAV */
-  if( SDL_LoadWAV(fileName.c_str(), &wavSpec, &wavBuffer, &wavLength) == NULL)
-  {
-    PRINTF(2)("Could not open %s: %s\n", fileName.c_str(), SDL_GetError());
-    return false;
+    // generate a Buffer
+    alGenBuffers(1, &this->bufferID);
+    SoundEngine::checkError("Generate Buffer", __LINE__);
+    this->loadWAV(fileName);
   }
 
-  alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), wavBuffer, wavLength, wavSpec.freq);
-  SDL_FreeWAV(wavBuffer);
-  if (SoundEngine::checkError("Could not load Wave file", __LINE__))
-    return true;
-  else
-    return false;
+  SoundBuffer::~SoundBuffer()
+  {
+    //  SoundEngine::getInstance()->removeBuffer(this);
+    alDeleteBuffers(1, &this->bufferID);
+    SoundEngine::checkError("SoundBuffer: Delete Buffer", __LINE__);
+  }
+
+  /**
+   * @brief loads a Waveform from the local fileSystem into this Source.
+   * @param fileName the Name of the File to Load.
+   * @returns true on success.
+   */
+  bool SoundBuffer::loadWAV(const std::string& fileName)
+  {
+    SDL_AudioSpec wavSpec;
+    Uint32 wavLength;
+    Uint8 *wavBuffer;
+
+    /* Load the WAV */
+    if( SDL_LoadWAV(fileName.c_str(), &wavSpec, &wavBuffer, &wavLength) == NULL)
+    {
+      PRINTF(2)("Could not open %s: %s\n", fileName.c_str(), SDL_GetError());
+      return false;
+    }
+
+    alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), wavBuffer, wavLength, wavSpec.freq);
+    SDL_FreeWAV(wavBuffer);
+    if (SoundEngine::checkError("Could not load Wave file", __LINE__))
+      return true;
+    else
+      return false;
+  }
+
+  /**
+   * @brief converts an SDL_AudioSpec into a valid OpenAL AUDIO_FORMAT enumerator
+   * @param audiospec the AudioSpec to convert.
+   * @returns the AL_FORMAT
+   */
+  ALenum SoundBuffer::sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec)
+  {
+    assert (audiospec != NULL);
+    bool stereo = true;
+    bool is16Bit = true;
+    if (audiospec->format == AUDIO_U8 || audiospec->format == AUDIO_S8)
+      is16Bit = false;
+    if (audiospec->channels == 1)
+      stereo = false;
+
+    if (!stereo && !is16Bit)
+      return AL_FORMAT_MONO8;
+    else if (!stereo && is16Bit)
+      return AL_FORMAT_MONO16;
+    else if (stereo && !is16Bit)
+      return AL_FORMAT_STEREO8;
+    else if (stereo && is16Bit)
+      return AL_FORMAT_STEREO16;
+  }
 }
-
-/**
- * @brief converts an SDL_AudioSpec into a valid OpenAL AUDIO_FORMAT enumerator
- * @param audiospec the AudioSpec to convert.
- * @returns the AL_FORMAT
- */
-ALenum SoundBuffer::sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec)
-{
-  assert (audiospec != NULL);
-  bool stereo = true;
-  bool is16Bit = true;
-  if (audiospec->format == AUDIO_U8 || audiospec->format == AUDIO_S8)
-    is16Bit = false;
-  if (audiospec->channels == 1)
-    stereo = false;
-
-  if (!stereo && !is16Bit)
-    return AL_FORMAT_MONO8;
-  else if (!stereo && is16Bit)
-    return AL_FORMAT_MONO16;
-  else if (stereo && !is16Bit)
-    return AL_FORMAT_STEREO8;
-  else if (stereo && is16Bit)
-    return AL_FORMAT_STEREO16;
-}
-
Index: /trunk/src/lib/sound/sound_buffer.h
===================================================================
--- /trunk/src/lib/sound/sound_buffer.h	(revision 7459)
+++ /trunk/src/lib/sound/sound_buffer.h	(revision 7460)
@@ -13,7 +13,9 @@
 typedef struct SDL_AudioSpec;
 
-//! A class that represents a datastructure to play Sounds.
-class SoundBuffer : public BaseObject
+namespace OrxSound
 {
+  //! A class that represents a datastructure to play Sounds.
+  class SoundBuffer : public BaseObject
+  {
   public:
     SoundBuffer(const std::string& fileName);
@@ -33,5 +35,5 @@
     ALsizei       size;                 //!< The size of the Buffer.
     ALboolean     loop;                 //!< loop information.
-};
-
+  };
+}
 #endif /* _SOUND_BUFFER_H */
Index: /trunk/src/lib/sound/sound_engine.cc
===================================================================
--- /trunk/src/lib/sound/sound_engine.cc	(revision 7459)
+++ /trunk/src/lib/sound/sound_engine.cc	(revision 7460)
@@ -29,363 +29,363 @@
 #include "globals.h"
 
-using namespace std;
-
-
-//////////////////
-/* SOUND-ENGINE */
-//////////////////
-/**
- * @brief standard constructor
-*/
-SoundEngine::SoundEngine ()
+namespace OrxSound
 {
-  this->setClassID(CL_SOUND_ENGINE, "SoundEngine");
-  this->setName("SoundEngine");
-
-  this->listener = NULL;
-  this->bufferList = NULL;
-  this->sourceList = NULL;
-
-  this->device = NULL;
-  this->context = NULL;
-
-  this->maxSourceCount = 32;
-
-  this->effectsVolume = .80;
-  this->musicVolume = .75;
-
-  this->sourceMutex = SDL_CreateMutex();
-}
-
-/**
- * @brief the singleton reference to this class
-*/
-SoundEngine* SoundEngine::singletonRef = NULL;
-
-/**
- * @brief standard destructor
- */
-SoundEngine::~SoundEngine ()
-{
-  // deleting all the SoundSources
-  if(this->sourceList != NULL)
-  {
-    while (this->sourceList->size() > 0)
-      delete static_cast<SoundSource*>(this->sourceList->front());
-  }
-
-  while(!this->ALSources.empty())
-  {
-    if (alIsSource(this->ALSources.top()))
-    {
-      alDeleteSources(1, &this->ALSources.top());
-      SoundEngine::checkError("Deleting Source", __LINE__);
+
+  //////////////////
+  /* SOUND-ENGINE */
+  //////////////////
+  /**
+   * @brief standard constructor
+  */
+  SoundEngine::SoundEngine ()
+  {
+    this->setClassID(CL_SOUND_ENGINE, "SoundEngine");
+    this->setName("SoundEngine");
+
+    this->listener = NULL;
+    this->bufferList = NULL;
+    this->sourceList = NULL;
+
+    this->device = NULL;
+    this->context = NULL;
+
+    this->maxSourceCount = 32;
+
+    this->effectsVolume = .80;
+    this->musicVolume = .75;
+
+    this->sourceMutex = SDL_CreateMutex();
+  }
+
+  /**
+   * @brief the singleton reference to this class
+  */
+  SoundEngine* SoundEngine::singletonRef = NULL;
+
+  /**
+   * @brief standard destructor
+   */
+  SoundEngine::~SoundEngine ()
+  {
+    // deleting all the SoundSources
+    if(this->sourceList != NULL)
+    {
+      while (this->sourceList->size() > 0)
+        delete static_cast<SoundSource*>(this->sourceList->front());
+    }
+
+    while(!this->ALSources.empty())
+    {
+      if (alIsSource(this->ALSources.top()))
+      {
+        alDeleteSources(1, &this->ALSources.top());
+        SoundEngine::checkError("Deleting Source", __LINE__);
+      }
+      else
+        PRINTF(1)("%d is not a Source\n", this->ALSources.top());
+
+      this->ALSources.pop();
+    }
+
+    // deleting all the SoundBuffers
+    if (this->bufferList != NULL)
+    {
+      while(this->bufferList->size() > 0)
+        ResourceManager::getInstance()->unload(static_cast<SoundBuffer*>(this->bufferList->front()));
+    }
+
+    // removing openAL from AudioResource
+    //! @todo this should be terminated through alc
+    //alutExit();
+
+    SDL_DestroyMutex(this->sourceMutex);
+
+    SoundEngine::singletonRef = NULL;
+  }
+
+  /**
+   * @brief loads the settings of the SoundEngine from an ini-file
+   */
+  void SoundEngine::loadSettings()
+  {
+    MultiType channels = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_AUDIO_CHANNELS, "32");
+    this->maxSourceCount = channels.getInt();
+
+    MultiType effectsVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_EFFECTS_VOLUME, "80");
+    this->effectsVolume = effectsVolume.getFloat()/100.0;
+
+    MultiType musicVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_MUSIC_VOLUME, "75");
+    this->musicVolume = musicVolume.getFloat()/100.0;
+  }
+
+  /**
+   * @brief creates a new SoundSource.
+   * @param fileName The Name to load the SoundBuffer from
+   * @param sourceNode The sourceNode to bind this SoundSource to.
+   * @returns The newly created SoundSource
+   *
+   * acctualy this is nothing more than a wrapper around the ResourceManager.
+  */
+  SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode)
+  {
+    SoundBuffer* buffer = NULL;
+    if (!fileName.empty())
+    {
+      buffer= (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL);
+      if (buffer == NULL)
+        PRINTF(2)("Wav-Sound %s could not be loaded onto new Source\n", fileName.c_str());
+    }
+    return new SoundSource(sourceNode, buffer);
+  }
+
+  /**
+   * @brief Sets the doppler values of openAL
+   * @param dopplerFactor the extent of the doppler-effect
+   * @param dopplerVelocity the Speed the sound travels
+  */
+  void SoundEngine::setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity)
+  {
+    alDopplerFactor(dopplerFactor);
+    this->checkError("Setting Doppler Factor", __LINE__);
+
+    alDopplerVelocity(dopplerVelocity);
+    this->checkError("Setting Doppler Velocity", __LINE__);
+  }
+
+
+  /**
+   * @brief retrieves an OpenAL Source from the availiable Sources.
+   * @param source the Source to fill with the Value.
+   */
+  void SoundEngine::popALSource(ALuint& source)
+  {
+    assert (source == 0);
+    /// @TODO try to create more sources if needed
+    if (!this->ALSources.empty())
+    {
+      SDL_mutexP(this->sourceMutex);
+      source = this->ALSources.top();
+      this->ALSources.pop();
+      SDL_mutexV(this->sourceMutex);
+    }
+  }
+
+
+  /**
+   * @brief Pushes an OpenAL Source back into the Stack of known sources
+   * @param source the Source to push onto the top of the SourceStack
+   */
+  void SoundEngine::pushALSource(ALuint& source)
+  {
+    if (source != 0)
+    {
+      SDL_mutexP(this->sourceMutex);
+      this->ALSources.push(source);
+      SDL_mutexV(this->sourceMutex);
+    }
+  };
+
+
+  /**
+   * @brief updates all The positions, Directions and Velocities of all Sounds
+   */
+  void SoundEngine::update()
+  {
+    // updating the Listeners Position
+    if (likely(this->listener != NULL))
+    {
+      alListener3f(AL_POSITION,
+                   this->listener->getAbsCoor().x,
+                   this->listener->getAbsCoor().y,
+                   this->listener->getAbsCoor().z);
+      alListener3f(AL_VELOCITY,
+                   this->listener->getVelocity().x,
+                   this->listener->getVelocity().y,
+                   this->listener->getVelocity().z);
+      Vector absDirV = this->listener->getAbsDirV();
+      ALfloat orientation [6] = {1,0,0, absDirV.x, absDirV.y, absDirV.z};
+      alListenerfv(AL_ORIENTATION, orientation);
+      SoundEngine::checkError("SoundEngine::update() - Listener Error", __LINE__);
     }
     else
-      PRINTF(1)("%d is not a Source\n", this->ALSources.top());
-
-    this->ALSources.pop();
-  }
-
-  // deleting all the SoundBuffers
-  if (this->bufferList != NULL)
-  {
-    while(this->bufferList->size() > 0)
-      ResourceManager::getInstance()->unload(static_cast<SoundBuffer*>(this->bufferList->front()));
-  }
-
-  // removing openAL from AudioResource
-  //! @todo this should be terminated through alc
-  //alutExit();
-
-  SDL_DestroyMutex(this->sourceMutex);
-
-  SoundEngine::singletonRef = NULL;
-}
-
-/**
- * @brief loads the settings of the SoundEngine from an ini-file
- */
-void SoundEngine::loadSettings()
-{
-  MultiType channels = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_AUDIO_CHANNELS, "32");
-  this->maxSourceCount = channels.getInt();
-
-  MultiType effectsVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_EFFECTS_VOLUME, "80");
-  this->effectsVolume = effectsVolume.getFloat()/100.0;
-
-  MultiType musicVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_MUSIC_VOLUME, "75");
-  this->musicVolume = musicVolume.getFloat()/100.0;
-}
-
-/**
- * @brief creates a new SoundSource.
- * @param fileName The Name to load the SoundBuffer from
- * @param sourceNode The sourceNode to bind this SoundSource to.
- * @returns The newly created SoundSource
- *
- * acctualy this is nothing more than a wrapper around the ResourceManager.
-*/
-SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode)
-{
-  SoundBuffer* buffer = NULL;
-  if (!fileName.empty())
-  {
-     buffer= (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL);
-     if (buffer == NULL)
-       PRINTF(2)("Wav-Sound %s could not be loaded onto new Source\n", fileName.c_str());
-  }
-    return new SoundSource(sourceNode, buffer);
-}
-
-/**
- * @brief Sets the doppler values of openAL
- * @param dopplerFactor the extent of the doppler-effect
- * @param dopplerVelocity the Speed the sound travels
-*/
-void SoundEngine::setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity)
-{
-  alDopplerFactor(dopplerFactor);
-  this->checkError("Setting Doppler Factor", __LINE__);
-
-  alDopplerVelocity(dopplerVelocity);
-  this->checkError("Setting Doppler Velocity", __LINE__);
-}
-
-
-/**
- * @brief retrieves an OpenAL Source from the availiable Sources.
- * @param source the Source to fill with the Value.
- */
-void SoundEngine::popALSource(ALuint& source)
-{
-  assert (source == 0);
-  /// @TODO try to create more sources if needed
-  if (!this->ALSources.empty())
-  {
-    SDL_mutexP(this->sourceMutex);
-    source = this->ALSources.top();
-    this->ALSources.pop();
-    SDL_mutexV(this->sourceMutex);
-  }
-}
-
-
-/**
- * @brief Pushes an OpenAL Source back into the Stack of known sources
- * @param source the Source to push onto the top of the SourceStack
- */
-void SoundEngine::pushALSource(ALuint& source)
-{
-  if (source != 0)
-  {
-    SDL_mutexP(this->sourceMutex);
-    this->ALSources.push(source);
-    SDL_mutexV(this->sourceMutex);
-  }
-};
-
-
-/**
- * @brief updates all The positions, Directions and Velocities of all Sounds
- */
-void SoundEngine::update()
-{
-  // updating the Listeners Position
-  if (likely(this->listener != NULL))
-  {
-    alListener3f(AL_POSITION,
-                 this->listener->getAbsCoor().x,
-                 this->listener->getAbsCoor().y,
-                 this->listener->getAbsCoor().z);
-    alListener3f(AL_VELOCITY,
-                 this->listener->getVelocity().x,
-                 this->listener->getVelocity().y,
-                 this->listener->getVelocity().z);
-    Vector absDirV = this->listener->getAbsDirV();
-    ALfloat orientation [6] = {1,0,0, absDirV.x, absDirV.y, absDirV.z};
-    alListenerfv(AL_ORIENTATION, orientation);
-    SoundEngine::checkError("SoundEngine::update() - Listener Error", __LINE__);
-  }
-  else
-    PRINTF(2)("no listener defined\n");
-
-  // updating all the Sources positions
-  if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL))
-  {
-    list<BaseObject*>::const_iterator sourceIT;
-    SoundSource* source;
-    for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
-    {
-      source = static_cast<SoundSource*>(*sourceIT);
-      if (source->isPlaying())
+      PRINTF(2)("no listener defined\n");
+
+    // updating all the Sources positions
+    if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL))
+    {
+      std::list<BaseObject*>::const_iterator sourceIT;
+      SoundSource* source;
+      for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
       {
-        int play = 0x000;
-        alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
-        if (DEBUG > 2)
-          SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
-        if(play == AL_PLAYING)
+        source = static_cast<SoundSource*>(*sourceIT);
+        if (source->isPlaying())
         {
-          if (likely(source->getNode() != NULL))
+          int play = 0x000;
+          alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
+          if (DEBUG > 2)
+            SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
+          if(play == AL_PLAYING)
           {
-            alSource3f(source->getID(), AL_POSITION,
-                       source->getNode()->getAbsCoor().x,
-                       source->getNode()->getAbsCoor().y,
-                       source->getNode()->getAbsCoor().z);
-            if (DEBUG > 2)
-              SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
-            alSource3f(source->getID(), AL_VELOCITY,
-                       source->getNode()->getVelocity().x,
-                       source->getNode()->getVelocity().y,
-                       source->getNode()->getVelocity().z);
-            if (DEBUG > 2)
-              SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
+            if (likely(source->getNode() != NULL))
+            {
+              alSource3f(source->getID(), AL_POSITION,
+                         source->getNode()->getAbsCoor().x,
+                         source->getNode()->getAbsCoor().y,
+                         source->getNode()->getAbsCoor().z);
+              if (DEBUG > 2)
+                SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
+              alSource3f(source->getID(), AL_VELOCITY,
+                         source->getNode()->getVelocity().x,
+                         source->getNode()->getVelocity().y,
+                         source->getNode()->getVelocity().z);
+              if (DEBUG > 2)
+                SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
+            }
+          }
+          else
+          {
+            source->stop();
           }
         }
-        else
-        {
-          source->stop();
-        }
       }
     }
-  }
-  SoundEngine::checkError("SoundEngine::update()", __LINE__);
-}
-
-
-/**
- *  initializes Audio in general
-*/
-bool SoundEngine::initAudio()
-{
-  //   ALenum result;
-  //   PRINTF(3)("Initialisazing openAL sound engine\n");
-  //   const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
-  //   const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER);
-  //   const char* devWalk = deviceList;
-  //   //  if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
-  //   { // try out enumeration extension
-  //     PRINTF(3)("Enumeration-extension found\n");
-  //
-  //     PRINTF(3)("Default device: %s\n", defaultDevice);
-  //     do
-  //     {
-  //       PRINTF(3)("%s\n", devWalk);
-  //       devWalk += strlen(devWalk)+1;
-  //     }
-  //     while (devWalk[0] != '\0');
-  //  }
-
-  // INITIALIZING THE DEVICE:
-  //   char deviceName[] =
-  //   #ifdef __WIN32__
-  //     "Direct3D";
-  //   #else
-  //     "'( ( devices '( native null ) ) )";
-  //   #endif
-
-  this->device = alcOpenDevice(NULL);
-  this->checkALCError("opening Device", __LINE__);
-
-  PRINTF(4)("Audio-Specifier: %s\n", (const char*)alcGetString(this->device, ALC_DEVICE_SPECIFIER));
-  PRINTF(4)("Audio-Extensions: %s\n", (const char*)alcGetString(this->device, ALC_EXTENSIONS));
-
-
-  this->context = alcCreateContext(this->device, NULL);
-  this->checkALCError("creating Context", __LINE__);
-
-  alcMakeContextCurrent(this->context);
-  this->checkALCError("making Context Current", __LINE__);
-  // #endif
-
-  this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY);
-  this->allocateSources(this->maxSourceCount);
-  this->checkError("Allocating Sources", __LINE__);
-}
-
-
-/**
- * Allocates openAL sources
- * @param count how many sources to allocate
- * @returns true on success, false if at least one source could not be allocated
- */
-bool SoundEngine::allocateSources(unsigned int count)
-{
-  unsigned int failCount = 0;
-  for (unsigned int i = 0; i < count; i++)
-  {
-    ALuint source = 0;
-
-    alGenSources(1, &source);
-    this->checkError("allocate Source", __LINE__);
-    if (!alIsSource(source))
-    {
-      PRINTF(5)("not allocated Source\n");
-      failCount++;
-      continue;
-    }
-
-    alSourcef (source, AL_PITCH,    1.0      );
-    alSourcef (source, AL_GAIN,     this->getEffectsVolume() );
-    alSourcei (source, AL_LOOPING,  AL_FALSE );
-    this->ALSources.push(source);
-  }
-  if (failCount == 0)
-    return true;
-  else
-  {
-    PRINTF(2)("Failed to allocate %d of %d SoundSources\n", failCount, count);
-  }
-}
-
-/**
- * @brief checks for an OpenAL error
- * @param error the ErrorMessage to display
- * @param line on what line did the error occure.
- */
-bool SoundEngine::checkError(const std::string& error, unsigned int line)
-{
-  ALenum errorCode;
-  if ((errorCode = alGetError()) != AL_NO_ERROR)
-  {
-    PRINTF(1)("Error %s (line:%d): '%s'\n", error.c_str(), line, SoundEngine::getALErrorString(errorCode));
-    return false;
-  }
-  else
-    return true;
-}
-
-/**
- * @brief check for an ALC error.
- * @brief error the Error-String to display
- * @param line on that line, the error occured (debugging mode).
- */
-bool SoundEngine::checkALCError(const std::string& error, unsigned int line)
-{
-  ALenum errorCode;
-  if ((errorCode = alcGetError(this->device)) != ALC_NO_ERROR)
-  {
-    PRINTF(1)("Error %s (line:%d): '%s'\n", error.c_str(), line, SoundEngine::getALCErrorString(errorCode));
-    return false;
-  }
-  else
-    return true;
-}
-
-
-
-void SoundEngine::listDevices()
-{
-  printf("%s\n",(const char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER));
-}
-
-/**
- *  Transforms AL-errors into something readable
- * @param err The error found
-*/
-const char* SoundEngine::getALErrorString(ALenum err)
-{
-  switch(err)
-  {
+    SoundEngine::checkError("SoundEngine::update()", __LINE__);
+  }
+
+
+  /**
+   *  initializes Audio in general
+  */
+  bool SoundEngine::initAudio()
+  {
+    //   ALenum result;
+    //   PRINTF(3)("Initialisazing openAL sound engine\n");
+    //   const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
+    //   const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER);
+    //   const char* devWalk = deviceList;
+    //   //  if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
+    //   { // try out enumeration extension
+    //     PRINTF(3)("Enumeration-extension found\n");
+    //
+    //     PRINTF(3)("Default device: %s\n", defaultDevice);
+    //     do
+    //     {
+    //       PRINTF(3)("%s\n", devWalk);
+    //       devWalk += strlen(devWalk)+1;
+    //     }
+    //     while (devWalk[0] != '\0');
+    //  }
+
+    // INITIALIZING THE DEVICE:
+    //   char deviceName[] =
+    //   #ifdef __WIN32__
+    //     "Direct3D";
+    //   #else
+    //     "'( ( devices '( native null ) ) )";
+    //   #endif
+
+    this->device = alcOpenDevice(NULL);
+    this->checkALCError("opening Device", __LINE__);
+
+    PRINTF(4)("Audio-Specifier: %s\n", (const char*)alcGetString(this->device, ALC_DEVICE_SPECIFIER));
+    PRINTF(4)("Audio-Extensions: %s\n", (const char*)alcGetString(this->device, ALC_EXTENSIONS));
+
+
+    this->context = alcCreateContext(this->device, NULL);
+    this->checkALCError("creating Context", __LINE__);
+
+    alcMakeContextCurrent(this->context);
+    this->checkALCError("making Context Current", __LINE__);
+    // #endif
+
+    this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY);
+    this->allocateSources(this->maxSourceCount);
+    this->checkError("Allocating Sources", __LINE__);
+  }
+
+
+  /**
+   * Allocates openAL sources
+   * @param count how many sources to allocate
+   * @returns true on success, false if at least one source could not be allocated
+   */
+  bool SoundEngine::allocateSources(unsigned int count)
+  {
+    unsigned int failCount = 0;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      ALuint source = 0;
+
+      alGenSources(1, &source);
+      this->checkError("allocate Source", __LINE__);
+      if (!alIsSource(source))
+      {
+        PRINTF(5)("not allocated Source\n");
+        failCount++;
+        continue;
+      }
+
+      alSourcef (source, AL_PITCH,    1.0      );
+      alSourcef (source, AL_GAIN,     this->getEffectsVolume() );
+      alSourcei (source, AL_LOOPING,  AL_FALSE );
+      this->ALSources.push(source);
+    }
+    if (failCount == 0)
+      return true;
+    else
+    {
+      PRINTF(2)("Failed to allocate %d of %d SoundSources\n", failCount, count);
+    }
+  }
+
+  /**
+   * @brief checks for an OpenAL error
+   * @param error the ErrorMessage to display
+   * @param line on what line did the error occure.
+   */
+  bool SoundEngine::checkError(const std::string& error, unsigned int line)
+  {
+    ALenum errorCode;
+    if ((errorCode = alGetError()) != AL_NO_ERROR)
+    {
+      PRINTF(1)("Error %s (line:%d): '%s'\n", error.c_str(), line, SoundEngine::getALErrorString(errorCode));
+      return false;
+    }
+    else
+      return true;
+  }
+
+  /**
+   * @brief check for an ALC error.
+   * @brief error the Error-String to display
+   * @param line on that line, the error occured (debugging mode).
+   */
+  bool SoundEngine::checkALCError(const std::string& error, unsigned int line)
+  {
+    ALenum errorCode;
+    if ((errorCode = alcGetError(this->device)) != ALC_NO_ERROR)
+    {
+      PRINTF(1)("Error %s (line:%d): '%s'\n", error.c_str(), line, SoundEngine::getALCErrorString(errorCode));
+      return false;
+    }
+    else
+      return true;
+  }
+
+
+
+  void SoundEngine::listDevices()
+  {
+    printf("%s\n",(const char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER));
+  }
+
+  /**
+   *  Transforms AL-errors into something readable
+   * @param err The error found
+  */
+  const char* SoundEngine::getALErrorString(ALenum err)
+  {
+    switch(err)
+    {
     case AL_NO_ERROR:
       return ("AL_NO_ERROR");
@@ -400,12 +400,12 @@
     case AL_OUT_OF_MEMORY:
       return ("AL_OUT_OF_MEMORY");
-  };
-}
-
-
-const char* SoundEngine::getALCErrorString(ALenum err)
-{
-  switch(err)
-  {
+    };
+  }
+
+
+  const char* SoundEngine::getALCErrorString(ALenum err)
+  {
+    switch(err)
+    {
     case ALC_NO_ERROR:
       return ("AL_NO_ERROR");
@@ -420,4 +420,5 @@
     case ALC_OUT_OF_MEMORY:
       return("ALC_OUT_OF_MEMORY");
-  };
+    };
+  }
 }
Index: /trunk/src/lib/sound/sound_engine.h
===================================================================
--- /trunk/src/lib/sound/sound_engine.h	(revision 7459)
+++ /trunk/src/lib/sound/sound_engine.h	(revision 7460)
@@ -22,9 +22,9 @@
 // FORWARD DECLARATION
 class PNode;
-class IniParser;
-
-
-//! A class that handles audio via the openAudioLibrary
-class SoundEngine : public BaseObject {
+namespace OrxSound
+{
+  //! A class that handles audio via the openAudioLibrary
+  class SoundEngine : public BaseObject
+  {
   public:
     virtual ~SoundEngine();
@@ -32,11 +32,12 @@
     inline static SoundEngine* getInstance() { if (!SoundEngine::singletonRef) SoundEngine::singletonRef = new SoundEngine();  return SoundEngine::singletonRef; };
 
+    SoundSource* createSource(const std::string& fileName, PNode* sourceNode = NULL);
     void loadSettings();
-
-    SoundSource* createSource(const std::string& fileName, PNode* sourceNode = NULL);
+    bool initAudio();
 
     /** @param listener the listener in the scene */
-    void setListener(PNode* listener) { this->listener = listener; };
+  void setListener(const PNode* listener) { this->listener = listener; };
     void setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity);
+
 
 
@@ -48,13 +49,9 @@
     void update();
 
-  // administrative
+    // administrative
     void popALSource(ALuint& source);
     void pushALSource(ALuint& source);
 
-
-    bool initAudio();
-    bool allocateSources(unsigned int count);
-
-  // error handling:
+    // error handling:
     static bool checkError(const std::string& error, unsigned int line);
     bool checkALCError(const std::string& error, unsigned int line);
@@ -64,4 +61,5 @@
   private:
     SoundEngine();
+    bool allocateSources(unsigned int count);
 
     void listDevices();
@@ -75,5 +73,5 @@
     float                          musicVolume;              //!< the maximum volume of the music in % (0f,1f]
     float                          effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
-    PNode*                         listener;                 //!< The listener of the Scene
+    const PNode*                   listener;                 //!< The listener of the Scene
 
     const std::list<BaseObject*>*  bufferList;               //!< A list of buffers
@@ -84,5 +82,6 @@
 
     SDL_mutex*                     sourceMutex;              //!< A mutex so we can not harm the stack
-};
+  };
+}
 
 #endif /* _SOUND_ENGINE_H */
Index: /trunk/src/lib/sound/sound_source.cc
===================================================================
--- /trunk/src/lib/sound/sound_source.cc	(revision 7459)
+++ /trunk/src/lib/sound/sound_source.cc	(revision 7460)
@@ -22,236 +22,237 @@
 #include "compiler.h"
 
-using namespace std;
-
-/**
- * @brief creates a SoundSource at position sourceNode with the SoundBuffer buffer
- */
-SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer)
+namespace OrxSound
 {
-  this->setClassID(CL_SOUND_SOURCE, "SoundSource");
-
-  // adding the Source to the SourcesList of the SoundEngine
-  this->buffer = buffer;
-  this->sourceNode = sourceNode;
-  this->resident = false;
-
-  this->sourceID = 0;
-  this->bPlay = false;
+  /**
+   * @brief creates a SoundSource at position sourceNode with the SoundBuffer buffer
+   */
+  SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer)
+  {
+    this->setClassID(CL_SOUND_SOURCE, "SoundSource");
+
+    // adding the Source to the SourcesList of the SoundEngine
+    this->buffer = buffer;
+    this->sourceNode = sourceNode;
+    this->resident = false;
+
+    this->sourceID = 0;
+    this->bPlay = false;
+  }
+
+
+  /**
+   * @brief construct a SoundSource out of the another soundSource
+   * @param source the Source to create this source from.
+   *
+   * Copies the buffer from source to this Source.
+   * Acquires a new SourceID if source is Playing.
+   */
+  SoundSource::SoundSource(const SoundSource& source)
+  {
+    this->setClassID(CL_SOUND_SOURCE, "SoundSource");
+
+    // adding the Source to the SourcesList of the SoundEngine
+    this->buffer = source.buffer;
+    this->sourceNode = source.sourceNode;
+    this->resident = source.resident;
+
+    this->sourceID = 0;
+    if (source.bPlay == true)
+    {
+      this->bPlay = true;
+      SoundEngine::getInstance()->popALSource(this->sourceID);
+    }
+    else
+      this->bPlay = false;
+  }
+
+
+  /**
+   * @brief paste a copy of the source into this Source.
+   * @param source the SoundSource to paste into this one.
+   * @returns a Reference to this Source.
+   *
+   */
+  SoundSource& SoundSource::operator=(const SoundSource& source)
+  {
+    this->buffer = source.buffer;
+    this->sourceNode = sourceNode;
+    this->resident = source.resident;
+
+    if (source.bPlay)
+      this->play();
+    else
+      this->stop();
+  }
+
+
+  /**
+   * @brief compares two Sources with each other.
+   * @param source the Source to compare against this One.
+   * Two Sources are the same, if the PNodes match, and the Sound Played are the same.
+   * The alSource must not match, because no two Sources can have the same alSource.
+   */
+  bool SoundSource::operator==(const SoundSource& source)
+  {
+    return (this->buffer == source.buffer &&
+            this->bPlay == source.bPlay &&
+            this->sourceNode == source.sourceNode);
+  }
+
+
+  /**
+   * @brief deletes a SoundSource
+   */
+  SoundSource::~SoundSource()
+  {
+    this->stop();
+    if (this->sourceID != 0)
+      SoundEngine::getInstance()->pushALSource(this->sourceID);
+  }
+
+
+  /**
+   * @brief Plays back a SoundSource
+   */
+  void SoundSource::play()
+  {
+    if (this->buffer && this->retrieveSource())
+    {
+      if (this->bPlay)
+        alSourceStop(this->sourceID);
+      alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+      alSourcePlay(this->sourceID);
+
+      if (DEBUG >= 3)
+        SoundEngine::checkError("Play Source", __LINE__);
+      this->bPlay = true;
+    }
+  }
+
+
+  /**
+   * @brief Plays back buffer on this Source
+   * @param buffer the buffer to play back on this Source
+   */
+  void SoundSource::play(const SoundBuffer* buffer)
+  {
+    if (!this->retrieveSource())
+    {
+      PRINTF(3)("No more Free sources (You might consider raising the Source-Count).\n");
+      return;
+    }
+
+    alSourceStop(this->sourceID);
+    alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
+    alSourcePlay(this->sourceID);
+
+    if (unlikely(this->buffer != NULL))
+      alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+    this->bPlay = true;
+
+    if (DEBUG >= 3)
+      SoundEngine::checkError("Play Source", __LINE__);
+  }
+
+
+  /**
+   * @brief Stops playback of a SoundSource
+   */
+  void SoundSource::stop()
+  {
+    this->bPlay = false;
+    if (this->sourceID != 0)
+    {
+      alSourceStop(this->sourceID);
+      if (DEBUG >= 3)
+        SoundEngine::checkError("StopSource", __LINE__);
+      alSourcei(this->sourceID, AL_BUFFER, 0);
+      if (!this->resident)
+        SoundEngine::getInstance()->pushALSource(this->sourceID);
+      this->sourceID = 0;
+    }
+  }
+
+
+  /**
+   * @brief Pauses Playback of a SoundSource
+   */
+  void SoundSource::pause()
+  {
+    alSourcePause(this->sourceID);
+    if (DEBUG >= 3)
+      SoundEngine::checkError("Pause Source", __LINE__);
+  }
+
+
+  /**
+   * @brief Rewinds Playback of a SoundSource
+   */
+  void SoundSource::rewind()
+  {
+    alSourceRewind(this->sourceID);
+
+    if (DEBUG >= 3)
+      SoundEngine::checkError("Rewind Source", __LINE__);
+  }
+
+
+  /**
+   * @brief sets the RolloffFactor of the Sound emitted from the SoundSource
+   * @param rolloffFactor The Factor described
+   *
+   * this tells openAL how fast the Sounds decay outward from the Source
+   */
+  void SoundSource::setRolloffFactor(ALfloat rolloffFactor)
+  {
+    alSourcef(this->sourceID, AL_ROLLOFF_FACTOR, rolloffFactor);
+
+    if (DEBUG >= 3)
+      SoundEngine::checkError("Set Source Rolloff-factor", __LINE__);
+  }
+
+
+  /**
+   * @brief sets the Positional this Source should be attached to.
+   * @param sourceNode the Source this is attached to.
+   * If sourceNode == NULL then the Source will be centered, and Audio will be played on all channels.
+   */
+  void SoundSource::setSourceNode(const PNode* sourceNode)
+  {
+    this->sourceNode = sourceNode;
+  }
+
+  /**
+   * @brief retrieve a Source.
+   */
+  bool SoundSource::retrieveSource()
+  {
+    if (this->sourceID != 0)
+      return true;
+    else
+    {
+      SoundEngine::getInstance()->popALSource(this->sourceID);
+      if (this->sourceID != 0)
+      {
+        if (unlikely(this->sourceNode == NULL))
+          resetSource(this->sourceID);
+        return true;
+      }
+    }
+    return false;
+  }
+
+
+  /**
+   * @brief reset an alSource to its default Values.
+   */
+  void SoundSource::resetSource(ALuint sourceID)
+  {
+    alSource3f(sourceID, AL_POSITION,        0.0, 0.0, 0.0);
+    alSource3f(sourceID, AL_VELOCITY,        0.0, 0.0, 0.0);
+    alSource3f(sourceID, AL_DIRECTION,       0.0, 0.0, 0.0);
+    alSourcef (sourceID, AL_ROLLOFF_FACTOR,  0.0          );
+    //alSourcei (sourceID, AL_SOURCE_RELATIVE, AL_TRUE      );
+    alSourcef (sourceID, AL_GAIN,            SoundEngine::getInstance()->getEffectsVolume());
+  }
 }
-
-
-/**
- * @brief construct a SoundSource out of the another soundSource
- * @param source the Source to create this source from.
- *
- * Copies the buffer from source to this Source.
- * Acquires a new SourceID if source is Playing.
- */
-SoundSource::SoundSource(const SoundSource& source)
-{
-  this->setClassID(CL_SOUND_SOURCE, "SoundSource");
-
-  // adding the Source to the SourcesList of the SoundEngine
-  this->buffer = source.buffer;
-  this->sourceNode = source.sourceNode;
-  this->resident = source.resident;
-
-  this->sourceID = 0;
-  if (source.bPlay == true)
-  {
-    this->bPlay = true;
-    SoundEngine::getInstance()->popALSource(this->sourceID);
-  }
-  else
-    this->bPlay = false;
-}
-
-
-/**
- * @brief paste a copy of the source into this Source.
- * @param source the SoundSource to paste into this one.
- * @returns a Reference to this Source.
- *
- */
-SoundSource& SoundSource::operator=(const SoundSource& source)
-{
-  this->buffer = source.buffer;
-  this->sourceNode = sourceNode;
-  this->resident = source.resident;
-
-  if (source.bPlay)
-    this->play();
-  else
-    this->stop();
-}
-
-
-/**
- * @brief compares two Sources with each other.
- * @param source the Source to compare against this One.
- * Two Sources are the same, if the PNodes match, and the Sound Played are the same.
- * The alSource must not match, because no two Sources can have the same alSource.
- */
-bool SoundSource::operator==(const SoundSource& source)
-{
-  return (this->buffer == source.buffer &&
-          this->bPlay == source.bPlay &&
-          this->sourceNode == source.sourceNode);
-}
-
-
-/**
- * @brief deletes a SoundSource
- */
-SoundSource::~SoundSource()
-{
-  this->stop();
-  if (this->sourceID != 0)
-    SoundEngine::getInstance()->pushALSource(this->sourceID);
-}
-
-
-/**
- * @brief Plays back a SoundSource
- */
-void SoundSource::play()
-{
-  if (this->buffer && this->retrieveSource())
-  {
-    if (this->bPlay)
-      alSourceStop(this->sourceID);
-    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
-      alSourcePlay(this->sourceID);
-
-    if (DEBUG >= 3)
-      SoundEngine::checkError("Play Source", __LINE__);
-    this->bPlay = true;
-  }
-}
-
-
-/**
- * @brief Plays back buffer on this Source
- * @param buffer the buffer to play back on this Source
- */
-void SoundSource::play(const SoundBuffer* buffer)
-{
-  if (!this->retrieveSource())
-  {
-    PRINTF(3)("No more Free sources (You might consider raising the Source-Count).\n");
-    return;
-  }
-
-  alSourceStop(this->sourceID);
-  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
-  alSourcePlay(this->sourceID);
-
-  if (unlikely(this->buffer != NULL))
-    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
-  this->bPlay = true;
-
-  if (DEBUG >= 3)
-    SoundEngine::checkError("Play Source", __LINE__);
-}
-
-
-/**
- * @brief Stops playback of a SoundSource
- */
-void SoundSource::stop()
-{
-  this->bPlay = false;
-  if (this->sourceID != 0)
-  {
-    alSourceStop(this->sourceID);
-    if (DEBUG >= 3)
-      SoundEngine::checkError("StopSource", __LINE__);
-    alSourcei(this->sourceID, AL_BUFFER, 0);
-    if (!this->resident)
-      SoundEngine::getInstance()->pushALSource(this->sourceID);
-    this->sourceID = 0;
-  }
-}
-
-
-/**
- * @brief Pauses Playback of a SoundSource
- */
-void SoundSource::pause()
-{
-  alSourcePause(this->sourceID);
-  if (DEBUG >= 3)
-    SoundEngine::checkError("Pause Source", __LINE__);
-}
-
-
-/**
- * @brief Rewinds Playback of a SoundSource
- */
-void SoundSource::rewind()
-{
-  alSourceRewind(this->sourceID);
-
-  if (DEBUG >= 3)
-    SoundEngine::checkError("Rewind Source", __LINE__);
-}
-
-
-/**
- * @brief sets the RolloffFactor of the Sound emitted from the SoundSource
- * @param rolloffFactor The Factor described
- *
- * this tells openAL how fast the Sounds decay outward from the Source
- */
-void SoundSource::setRolloffFactor(ALfloat rolloffFactor)
-{
-  alSourcef(this->sourceID, AL_ROLLOFF_FACTOR, rolloffFactor);
-
-  if (DEBUG >= 3)
-    SoundEngine::checkError("Set Source Rolloff-factor", __LINE__);
-}
-
-
-/**
- * @brief sets the Positional this Source should be attached to.
- * @param sourceNode the Source this is attached to.
- * If sourceNode == NULL then the Source will be centered, and Audio will be played on all channels.
- */
-void SoundSource::setSourceNode(const PNode* sourceNode)
-{
-  this->sourceNode = sourceNode;
-}
-
-/**
- * @brief retrieve a Source.
- */
-bool SoundSource::retrieveSource()
-{
-  if (this->sourceID != 0)
-    return true;
-  else
-  {
-    SoundEngine::getInstance()->popALSource(this->sourceID);
-    if (this->sourceID != 0)
-    {
-      if (unlikely(this->sourceNode == NULL))
-        resetSource(this->sourceID);
-      return true;
-    }
-  }
-  return false;
-}
-
-
-/**
- * @brief reset an alSource to its default Values.
- */
-void SoundSource::resetSource(ALuint sourceID)
-{
-  alSource3f(sourceID, AL_POSITION,        0.0, 0.0, 0.0);
-  alSource3f(sourceID, AL_VELOCITY,        0.0, 0.0, 0.0);
-  alSource3f(sourceID, AL_DIRECTION,       0.0, 0.0, 0.0);
-  alSourcef (sourceID, AL_ROLLOFF_FACTOR,  0.0          );
-  //alSourcei (sourceID, AL_SOURCE_RELATIVE, AL_TRUE      );
-  alSourcef (sourceID, AL_GAIN,            SoundEngine::getInstance()->getEffectsVolume());
-}
Index: /trunk/src/lib/sound/sound_source.h
===================================================================
--- /trunk/src/lib/sound/sound_source.h	(revision 7459)
+++ /trunk/src/lib/sound/sound_source.h	(revision 7460)
@@ -11,10 +11,11 @@
 
 // FORWARD DECLARATION
-class SoundBuffer;
 class PNode;
-
-//! A class that represents a SoundSource
-class SoundSource : public BaseObject
+namespace OrxSound
 {
+  class SoundBuffer;
+  //! A class that represents a SoundSource
+  class SoundSource : public BaseObject
+  {
   public:
     SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
@@ -25,5 +26,5 @@
     virtual ~SoundSource();
 
-  // user interaction
+    // user interaction
     void play();
     void play(const SoundBuffer* buffer);
@@ -32,5 +33,5 @@
     void rewind();
 
-  // development functions
+    // development functions
     /** @returns The ID of this Source */
     inline ALuint getID() const { return this->sourceID; };
@@ -60,4 +61,5 @@
     const SoundBuffer*     buffer;                //!< The buffer to play in this source.
     const PNode*           sourceNode;            //!< The SourceNode representing the position/velocity... of this source.
-};
+  };
+}
 #endif /* _SOUND_SOURCE_H */
Index: /trunk/src/lib/util/loading/resource_manager.cc
===================================================================
--- /trunk/src/lib/util/loading/resource_manager.cc	(revision 7459)
+++ /trunk/src/lib/util/loading/resource_manager.cc	(revision 7460)
@@ -434,9 +434,9 @@
     case WAV:
       if(isFile(fullName))
-        tmpResource->pointer = new SoundBuffer(fullName);
+        tmpResource->pointer = new OrxSound::SoundBuffer(fullName);
       break;
     case OGG:
       if (isFile(fullName))
-        tmpResource->pointer = new OggPlayer(fullName);
+        tmpResource->pointer = new OrxSound::OggPlayer(fullName);
       break;
 #endif /* NO_AUDIO */
Index: /trunk/src/orxonox.cc
===================================================================
--- /trunk/src/orxonox.cc	(revision 7459)
+++ /trunk/src/orxonox.cc	(revision 7460)
@@ -131,5 +131,5 @@
   // engines
   delete CDEngine::getInstance();
-  delete SoundEngine::getInstance();
+  delete OrxSound::SoundEngine::getInstance();
   delete GraphicsEngine::getInstance(); // deleting the Graphics
   delete EventHandler::getInstance();
@@ -265,8 +265,8 @@
   PRINT(3)("> Initializing sound\n");
   // SDL_InitSubSystem(SDL_INIT_AUDIO);
-  SoundEngine::getInstance();
-
-  SoundEngine::getInstance()->loadSettings();
-  SoundEngine::getInstance()->initAudio();
+  OrxSound::SoundEngine::getInstance();
+
+  OrxSound::SoundEngine::getInstance()->loadSettings();
+  OrxSound::SoundEngine::getInstance()->initAudio();
   return 0;
 }
@@ -441,7 +441,7 @@
   else if ( Preferences::getInstance()->getString("misc", "bt-to-file", "1") == "1" )
   {      SignalHandler::getInstance()->doCatch( argv[0], GDB_RUN_WRITE_TO_FILE );
-    
-  }
-  
+
+  }
+
   if( Preferences::getInstance()->getString("game", "showGui", "") == "1" )
     showGui = true;
Index: /trunk/src/story_entities/game_world.cc
===================================================================
--- /trunk/src/story_entities/game_world.cc	(revision 7459)
+++ /trunk/src/story_entities/game_world.cc	(revision 7460)
@@ -400,5 +400,5 @@
   GraphicsEngine::getInstance()->update(this->dtS);
   PNode::getNullParent()->updateNode (this->dtS);
-  SoundEngine::getInstance()->update();
+  OrxSound::SoundEngine::getInstance()->update();
 }
 
Index: /trunk/src/story_entities/game_world_data.cc
===================================================================
--- /trunk/src/story_entities/game_world_data.cc	(revision 7459)
+++ /trunk/src/story_entities/game_world_data.cc	(revision 7460)
@@ -335,5 +335,5 @@
   if( this->sky != NULL)
     this->localCamera->addChild(this->sky);
-  SoundEngine::getInstance()->setListener(this->localCamera);
+  OrxSound::SoundEngine::getInstance()->setListener(this->localCamera);
 }
 
@@ -366,5 +366,5 @@
     PRINTF(3)("Setting Sound Track to %s\n", name.c_str());
     std::string oggFile = ResourceManager::getFullName(name);
-    this->music = new OggPlayer(oggFile);
+    this->music = new OrxSound::OggPlayer(oggFile);
 
     //(OggPlayer*)ResourceManager::getInstance()->load(name, OGG, RP_LEVEL);
Index: /trunk/src/story_entities/game_world_data.h
===================================================================
--- /trunk/src/story_entities/game_world_data.h	(revision 7459)
+++ /trunk/src/story_entities/game_world_data.h	(revision 7460)
@@ -19,5 +19,5 @@
 class GLMenuImageScreen;
 
-class OggPlayer;
+namespace OrxSound {class OggPlayer;}
 class GameRules;
 
@@ -59,5 +59,5 @@
     Terrain*                      terrain;        //!< The terrain - ground
 
-    OggPlayer*                    music;          //!< Reference to the SoundEngine's music player (OggPlayer)
+    OrxSound::OggPlayer*          music;          //!< Reference to the SoundEngine's music player (OggPlayer)
     ObjectManager*                objectManager;  //!< Reference to the objects manager
 
Index: /trunk/src/story_entities/simple_game_menu.cc
===================================================================
--- /trunk/src/story_entities/simple_game_menu.cc	(revision 7459)
+++ /trunk/src/story_entities/simple_game_menu.cc	(revision 7460)
@@ -248,5 +248,5 @@
 void SimpleGameMenu::setSelectorSound(const std::string& selectorSound)
 {
-  this->selectorSource = SoundEngine::getInstance()->createSource(selectorSound, NULL);
+  this->selectorSource = OrxSound::SoundEngine::getInstance()->createSource(selectorSound, NULL);
 }
 
Index: /trunk/src/story_entities/simple_game_menu.h
===================================================================
--- /trunk/src/story_entities/simple_game_menu.h	(revision 7459)
+++ /trunk/src/story_entities/simple_game_menu.h	(revision 7460)
@@ -20,7 +20,6 @@
 class TiXmlElement;
 class ImageEntity;
-class SoundSource;
 
-
+namespace OrxSound { class SoundSource; }
 
 class MenuLayer
@@ -89,5 +88,5 @@
     Vector                            cameraVector;
 
-    SoundSource*                      selectorSource;
+    OrxSound::SoundSource*            selectorSource;
 };
 
Index: /trunk/src/world_entities/effects/lightning_bolt.cc
===================================================================
--- /trunk/src/world_entities/effects/lightning_bolt.cc	(revision 7459)
+++ /trunk/src/world_entities/effects/lightning_bolt.cc	(revision 7460)
@@ -61,5 +61,5 @@
   if (this->thunderBuffer != NULL)
     ResourceManager::getInstance()->unload(this->thunderBuffer);
-  this->thunderBuffer = (SoundBuffer*)ResourceManager::getInstance()->load("sound/thunder.wav", WAV);
+  this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/thunder.wav", WAV);
 }
 
Index: /trunk/src/world_entities/effects/lightning_bolt.h
===================================================================
--- /trunk/src/world_entities/effects/lightning_bolt.h	(revision 7459)
+++ /trunk/src/world_entities/effects/lightning_bolt.h	(revision 7460)
@@ -50,6 +50,6 @@
     float seedTime;
 
-    SoundSource    soundSource;
-    SoundBuffer*   thunderBuffer;
+    OrxSound::SoundSource    soundSource;
+    OrxSound::SoundBuffer*   thunderBuffer;
 };
 
Index: /trunk/src/world_entities/power_ups/power_up.cc
===================================================================
--- /trunk/src/world_entities/power_ups/power_up.cc	(revision 7459)
+++ /trunk/src/world_entities/power_ups/power_up.cc	(revision 7460)
@@ -82,5 +82,5 @@
   else if (!pickupSound.empty())
   {
-    this->pickupBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV);
+    this->pickupBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV);
     if (this->pickupBuffer != NULL)
     {
@@ -103,5 +103,5 @@
   else if (!respawnSound.empty())
   {
-    this->respawnBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(respawnSound, WAV);
+    this->respawnBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(respawnSound, WAV);
     if (this->respawnBuffer != NULL)
     {
Index: /trunk/src/world_entities/power_ups/power_up.h
===================================================================
--- /trunk/src/world_entities/power_ups/power_up.h	(revision 7459)
+++ /trunk/src/world_entities/power_ups/power_up.h	(revision 7460)
@@ -45,14 +45,14 @@
 
 private:
-  SoundSource         soundSource;
-  SoundBuffer*        pickupBuffer;
-  SoundBuffer*        respawnBuffer;
-  Material*           sphereMaterial;
-  PowerUpRespawn      respawnType;
-  float               respawnTime;
-  float               respawnStart;
-  static const char*  respawnTypes[];
+  OrxSound::SoundSource  soundSource;
+  OrxSound::SoundBuffer* pickupBuffer;
+  OrxSound::SoundBuffer* respawnBuffer;
+  Material*              sphereMaterial;
+  PowerUpRespawn         respawnType;
+  float                  respawnTime;
+  float                  respawnStart;
+  static const char*     respawnTypes[];
 
-  WorldEntity*        collider;
+  WorldEntity*           collider;
 };
 
Index: /trunk/src/world_entities/projectiles/projectile.cc
===================================================================
--- /trunk/src/world_entities/projectiles/projectile.cc	(revision 7459)
+++ /trunk/src/world_entities/projectiles/projectile.cc	(revision 7460)
@@ -68,5 +68,5 @@
   else if (!explosionSound.empty())
   {
-    this->explosionBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV);
+    this->explosionBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV);
     if (this->explosionBuffer != NULL)
     {
@@ -90,5 +90,5 @@
   else if (!engineSound.empty())
   {
-    this->engineBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV);
+    this->engineBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV);
     if (this->engineBuffer != NULL)
     {
Index: /trunk/src/world_entities/projectiles/projectile.h
===================================================================
--- /trunk/src/world_entities/projectiles/projectile.h	(revision 7459)
+++ /trunk/src/world_entities/projectiles/projectile.h	(revision 7460)
@@ -52,20 +52,20 @@
   protected:
     // energy
-    float                 energyMin;                 //!< The minimal Energy a Projectile needs to be emitted.
-    bool                  bChargeable;               //!< if the Projectile is Charegeable
+    float                  energyMin;                 //!< The minimal Energy a Projectile needs to be emitted.
+    bool                   bChargeable;               //!< if the Projectile is Charegeable
 
-    float                 lifeCycle;                 //!< The percentage of the Lifetime done [0-1]
-    float                 lifeSpan;                  //!< The entire lifespan of the Shoot. in seconds
+    float                  lifeCycle;                 //!< The percentage of the Lifetime done [0-1]
+    float                  lifeSpan;                  //!< The entire lifespan of the Shoot. in seconds
 
-    Vector                flightDirection;           //!< DOF direction in which the shoot flighs
+    Vector                 flightDirection;           //!< DOF direction in which the shoot flighs
 
-    Vector                velocity;                  //!< velocity of the projectile.
+    Vector                 velocity;                  //!< velocity of the projectile.
 
-    PNode*                target;                    //!< A target for guided Weapons.
+    PNode*                 target;                    //!< A target for guided Weapons.
 
-    SoundSource          soundSource;
+    OrxSound::SoundSource  soundSource;
   private:
-    SoundBuffer*          explosionBuffer;
-    SoundBuffer*          engineBuffer;
+    OrxSound::SoundBuffer* explosionBuffer;
+    OrxSound::SoundBuffer* engineBuffer;
 };
 
Index: /trunk/src/world_entities/weapons/weapon.cc
===================================================================
--- /trunk/src/world_entities/weapons/weapon.cc	(revision 7459)
+++ /trunk/src/world_entities/weapons/weapon.cc	(revision 7460)
@@ -107,5 +107,5 @@
     this->soundBuffers[i] = NULL;                  //< No Sounds
 
-  this->soundSource = new SoundSource(this);       //< Every Weapon has exacty one SoundSource.
+  this->soundSource = new OrxSound::SoundSource(this);       //< Every Weapon has exacty one SoundSource.
   this->emissionPoint.setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
   this->emissionPoint.setName("EmissionPoint");
@@ -263,5 +263,5 @@
   else if (!soundFile.empty())
   {
-    this->soundBuffers[action] = (SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
+    this->soundBuffers[action] = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
     if (this->soundBuffers[action] != NULL)
     {
Index: /trunk/src/world_entities/weapons/weapon.h
===================================================================
--- /trunk/src/world_entities/weapons/weapon.h	(revision 7459)
+++ /trunk/src/world_entities/weapons/weapon.h	(revision 7460)
@@ -218,20 +218,20 @@
     // PHASES //
     ////////////
-    SoundSource*         soundSource;                      //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
-
-    WeaponState          currentState;                     //!< The State the weapon is in.
-    WeaponAction         requestedAction;                  //!< An action to try to Engage after the currentState ends.
-    float                stateDuration;                    //!< how long the state has taken until now.
-    float                times[WS_STATE_COUNT];            //!< Times to stay in the different States @see WeaponState.
-    Animation3D*         animation[WS_STATE_COUNT];        //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
-    SoundBuffer*         soundBuffers[WA_ACTION_COUNT];    //!< SoundBuffers for all actions @see WeaponAction.
-
-    PNode                emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
-
-    bool                 hideInactive;                    //!< Hides the Weapon if it is inactive
-    bool                 chargeable;                      //!< if the Weapon is charcheable (if true, the weapon will charge before it fires.)
-
-    ClassID              projectile;                      //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.)
-    FastFactory*         projectileFactory;               //!< A factory, that produces and handles the projectiles.
+    OrxSound::SoundSource* soundSource;                      //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
+
+    WeaponState            currentState;                     //!< The State the weapon is in.
+    WeaponAction           requestedAction;                  //!< An action to try to Engage after the currentState ends.
+    float                  stateDuration;                    //!< how long the state has taken until now.
+    float                  times[WS_STATE_COUNT];            //!< Times to stay in the different States @see WeaponState.
+    Animation3D*           animation[WS_STATE_COUNT];        //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
+    OrxSound::SoundBuffer* soundBuffers[WA_ACTION_COUNT];    //!< SoundBuffers for all actions @see WeaponAction.
+
+    PNode                  emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
+
+    bool                   hideInactive;                    //!< Hides the Weapon if it is inactive
+    bool                   chargeable;                      //!< if the Weapon is charcheable (if true, the weapon will charge before it fires.)
+
+    ClassID                projectile;                      //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.)
+    FastFactory*           projectileFactory;               //!< A factory, that produces and handles the projectiles.
   };
 
Index: /trunk/src/world_entities/world_entity.h
===================================================================
--- /trunk/src/world_entities/world_entity.h	(revision 7459)
+++ /trunk/src/world_entities/world_entity.h	(revision 7460)
@@ -16,6 +16,5 @@
 
 // FORWARD DECLARATION
-class SoundBuffer;
-class SoundSource;
+namespace OrxSound { class SoundBuffer; class SoundSource; }
 class BVTree;
 class Model;
