Index: trunk/src/lib/sound/ogg_player.cc
===================================================================
--- trunk/src/lib/sound/ogg_player.cc	(revision 7307)
+++ trunk/src/lib/sound/ogg_player.cc	(revision 7308)
@@ -35,10 +35,11 @@
   this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");
 
-  this->state = None;
+  this->state = OggPlayer::None;
 
   this->source = 0;
   this->buffers[0] = 0;
   this->buffers[1] = 0;
-  this->musicThread = NULL;
+  this->musicThreadID = NULL;
+  this->musicMutex = SDL_CreateMutex();
 
   if (!fileName.empty())
@@ -47,4 +48,5 @@
       this->setName(fileName);
   }
+
 }
 
@@ -55,4 +57,5 @@
 {
   this->release();
+  SDL_DestroyMutex(this->musicMutex);
 }
 
@@ -67,5 +70,5 @@
 {
   // release old Ogg-File (if loaded)
-  if (this->state & FileOpened)
+  if (this->state & OggPlayer::FileOpened)
     this->release();
 
@@ -75,5 +78,5 @@
   SoundEngine::checkError("Allocating Buffers", __LINE__);
   if (this->buffers[0] != 0 && this->buffers[1] != 0)
-    state |= BuffersAllocated;
+    state |= OggPlayer::BuffersAllocated;
   else
   {
@@ -86,5 +89,5 @@
     SoundEngine::getInstance()->popALSource(this->source);
   if (this->source != 0)
-    state |= SourceAllocated;
+    state |= OggPlayer::SourceAllocated;
   else
   {
@@ -110,5 +113,5 @@
     return false;
   }
-  this->state |= FileOpened;
+  this->state |= OggPlayer::FileOpened;
 
   // acquiring the vorbis-properties.
@@ -142,5 +145,5 @@
 bool OggPlayer::play()
 {
-  if (!(this->state & FileOpened))
+  if (!(this->state & OggPlayer::FileOpened))
     return false;
 
@@ -150,6 +153,6 @@
     return false;
 
-  if (this->musicThread == NULL)
-    return ((this->musicThread = SDL_CreateThread(OggPlayer::createAudioThread, (void*)this)) != NULL);
+  if (this->musicThreadID == NULL)
+    return ((this->musicThreadID = SDL_CreateThread(OggPlayer::musicThread, (void*)this)) != NULL);
   return true;
 }
@@ -189,6 +192,11 @@
 void OggPlayer::jumpTo(float timeCode)
 {
+
   if (this->state & OggPlayer::FileOpened)
+  {
+    SDL_mutexP(this->musicMutex);
     ov_time_seek(&this->oggStream, timeCode);
+    SDL_mutexV(this->musicMutex);
+  }
 }
 
@@ -210,5 +218,5 @@
 bool OggPlayer::isPlaying()
 {
-  if (!(this->state & FileOpened))
+  if (!(this->state & OggPlayer::FileOpened))
     return false;
   ALenum state;
@@ -229,14 +237,16 @@
  * @returns -1 on error.
  */
-int OggPlayer::createAudioThread(void* oggPlayer)
+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);
   }
@@ -264,9 +274,5 @@
   if (DEBUG >= 3)
     SoundEngine::checkError("OggPlayer::playback()::alSourceQueueBuffers", __LINE__);
-  if (!alIsBuffer(this->buffers[0])) printf("AHA0\n");
-  if (!alIsBuffer(this->buffers[1])) printf("AHA1\n");
-
-  if (!alIsSource(this->source)) printf("AHA2\n");
-  SoundEngine::checkError("SKJFLKSDJF",__LINE__);
+
 
   alSourcePlay(this->source);
@@ -282,10 +288,10 @@
 void OggPlayer::suspend()
 {
-  if (this->musicThread != NULL)
+  if (this->musicThreadID != NULL)
   {
     assert (!(this->state & Playing));
     this->printState();
-    SDL_WaitThread(this->musicThread, NULL);
-    this->musicThread = NULL;
+    SDL_WaitThread(this->musicThreadID, NULL);
+    this->musicThreadID = NULL;
   }
   if (this->state & OggPlayer::SourceAllocated)
@@ -302,8 +308,5 @@
 bool OggPlayer::update()
 {
-  if (unlikely(!(this->state & Playing)))
-    return false;
-
-  int processed;
+  int processed = 0;
   bool active = true;
 
@@ -372,5 +375,5 @@
 void OggPlayer::release()
 {
-  if (this->state & SourceAllocated)
+  if (this->state & OggPlayer::SourceAllocated)
   {
     assert(alIsSource(this->source));
@@ -379,5 +382,5 @@
       this->state &= ~OggPlayer::Playing;
       // Kill the Music Thread.
-      if (this->musicThread != NULL)
+      if (this->musicThreadID != NULL)
         this->suspend();
 
@@ -390,5 +393,5 @@
     this->state &= ~SourceAllocated;
   }
-  if (this->state & BuffersAllocated)
+  if (this->state & OggPlayer::BuffersAllocated)
   {
     assert (this->buffers[0] != 0 && this->buffers[1] != 0);
@@ -397,11 +400,11 @@
     this->buffers[0] = 0;
     this->buffers[1] = 0;
-    this->state &= ~BuffersAllocated;
-  }
-
-  if (this->state & FileOpened)
+    this->state &= ~OggPlayer::BuffersAllocated;
+  }
+
+  if (this->state & OggPlayer::FileOpened)
   {
     ov_clear(&oggStream);
-    this->state &= ~FileOpened;
+    this->state &= ~OggPlayer::FileOpened;
   }
 
@@ -457,17 +460,17 @@
 {
   PRINTF(0)("OggPlayer is in the following States: ");
-  if (this->state & FileOpened)
+  if (this->state & OggPlayer::FileOpened)
     PRINT(0)("FileOpened ");
-  if (this->state & SourceAllocated)
+  if (this->state & OggPlayer::SourceAllocated)
     PRINT(0)("SourceAllocated ");
-  if (this->state & BuffersAllocated)
+  if (this->state & OggPlayer::BuffersAllocated)
     PRINT(0)("BuffersAllocated ");
-  if (this->state & Stopped)
+  if (this->state & OggPlayer::Stopped)
     PRINT(0)("Stopped ");
-  if (this->state & Playing)
+  if (this->state & OggPlayer::Playing)
     PRINT(0)("Playing ");
-  if (this->state & Paused)
+  if (this->state & OggPlayer::Paused)
     PRINT(0)("Paused ");
-  if (this->state & Error)
+  if (this->state & OggPlayer::Error)
     PRINT(0)("Error ");
   PRINT(0)("\n");
Index: trunk/src/lib/sound/ogg_player.h
===================================================================
--- trunk/src/lib/sound/ogg_player.h	(revision 7307)
+++ trunk/src/lib/sound/ogg_player.h	(revision 7308)
@@ -20,5 +20,5 @@
 
 
-#define OGG_PLAYER_BUFFER_SIZE (8096 * 4)
+#define OGG_PLAYER_BUFFER_SIZE (8096 * 2)
 
 
@@ -66,5 +66,5 @@
 
 private:
-  static int createAudioThread(void* oggPlayer);
+  static int musicThread(void* oggPlayer);
   bool playback();
   void suspend();
@@ -87,5 +87,6 @@
   unsigned int        state;                //!< The States the OggPlayer is in (this can be multiple entries from OggPlayer::State).
 
-  SDL_Thread*         musicThread;          //!< The Thread in which music is Played back.
+  SDL_Thread*         musicThreadID;        //!< The Thread in which music is Played back.
+  SDL_mutex*          musicMutex;           //!< A Mutex so that the two threads do not interfere.
 };
 
