Index: trunk/src/lib/sound/ogg_player.cc
===================================================================
--- trunk/src/lib/sound/ogg_player.cc	(revision 7304)
+++ trunk/src/lib/sound/ogg_player.cc	(revision 7305)
@@ -54,21 +54,14 @@
 }
 
-/**
- * @brief jump to Second timeCode in the MusicFile
- * @param timeCode where to jump to.
- */
-void OggPlayer::jumpTo(float timeCode)
-{
-  if (this->state & FileOpened)
-    ov_time_seek(&this->oggStream, timeCode);
-}
-
-/**
- * opens a file for playback
+///////////////
+// INTERFACE //
+///////////////
+/**
+ * @brief opens a file for playback
  * @param fileName the file to open
  */
 bool OggPlayer::open(const std::string& fileName)
 {
-  // release old Ogg-File
+  // release old Ogg-File (if loaded)
   if (this->state & FileOpened)
     this->release();
@@ -109,5 +102,5 @@
   if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
   {
-    PRINTF(2)("Could not open Ogg stream. %s", errorString(result));
+    PRINTF(2)("Could not open Ogg stream. %s", getVorbisError(result));
     fclose(oggFile);
     this->release();
@@ -138,5 +131,56 @@
 
 
-
+/**
+ * @brief start Playing Music.
+ * @returns true on success false otherwise.
+ */
+bool OggPlayer::play()
+{
+  if (!(this->state & FileOpened))
+    return false;
+  if (this->musicThread == NULL)
+    return ((this->musicThread = SDL_CreateThread(OggPlayer::createAudioThread, (void*)this)) != NULL);
+  return true;
+}
+
+
+void OggPlayer::stop()
+{}
+
+void OggPlayer::pause()
+{}
+
+void OggPlayer::rewind()
+{}
+
+/**
+ * @brief jump to Second timeCode in the MusicFile
+ * @param timeCode where to jump to.
+ */
+void OggPlayer::jumpTo(float timeCode)
+{
+  if (this->state & FileOpened)
+    ov_time_seek(&this->oggStream, timeCode);
+}
+
+/**
+ * @returns true if the file is playing
+ */
+bool OggPlayer::isPlaying()
+{
+  if (!(this->state & FileOpened))
+    return false;
+  ALenum state;
+
+  alGetSourcei(this->source, AL_SOURCE_STATE, &state);
+
+  return (state == AL_PLAYING);
+}
+
+
+
+////////////////////////
+// INTERNAL FUNCTIONS //
+////////////////////////
 int OggPlayer::createAudioThread(void* oggPlayer)
 {
@@ -154,4 +198,106 @@
   }
   PRINTF(4)("End the AudioThread\n");
+}
+
+/**
+ * @brief plays back the sound
+ * @return true if running, false otherwise
+ */
+bool OggPlayer::playback()
+{
+  if (!(this->state & FileOpened))
+    return false;
+
+  if(this->isPlaying())
+    return true;
+  this->state |= Playing;
+
+  if(!this->stream(this->buffers[0]) || !this->stream(this->buffers[1]))
+    return false;
+
+  alSourceQueueBuffers(this->source, 2, this->buffers);
+  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);
+  if (DEBUG >= 3)
+    SoundEngine::checkError("OggPlayer::playback()::alSourcePlay", __LINE__);
+  return true;
+}
+
+
+/**
+ * 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()
+{
+  if (unlikely(!(this->state & Playing)))
+    return false;
+
+  int processed;
+  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;
+}
+
+/**
+ * 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;
 }
 
@@ -203,129 +349,6 @@
 
 
-bool OggPlayer::play()
-{
-  if (this->musicThread == NULL)
-    this->musicThread = SDL_CreateThread(OggPlayer::createAudioThread, (void*)this);
-}
-
-/**
- * plays back the sound
- * @return true if running, false otherwise
- */
-bool OggPlayer::playback()
-{
-  if (!(this->state & FileOpened))
-    return false;
-
-  if(playing())
-    return true;
-  this->state |= Playing;
-
-  if(!this->stream(this->buffers[0]) || !this->stream(this->buffers[1]))
-    return false;
-
-  alSourceQueueBuffers(this->source, 2, this->buffers);
-  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);
-  if (DEBUG >= 3)
-    SoundEngine::checkError("OggPlayer::playback()::alSourcePlay", __LINE__);
-  return true;
-}
-
-/**
- *
- * @returns true if the file is playing
- */
-bool OggPlayer::playing()
-{
-  if (!(this->state & FileOpened))
-    return false;
-  ALenum state;
-
-  alGetSourcei(this->source, AL_SOURCE_STATE, &state);
-
-  return (state == AL_PLAYING);
-}
-
-/**
- * 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()
-{
-  if (unlikely(!(this->state & Playing)))
-    return false;
-
-  int processed;
-  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;
-}
-
-/**
- * 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 errorString(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;
-}
-
-
-/**
- * empties the buffers
+/**
+ * @brief empties the buffers
  */
 void OggPlayer::empty()
@@ -345,8 +368,11 @@
 
 
+/////////////////////
+// DEBUG FUNCTIONS //
+/////////////////////
 /**
  * displays some info about the ogg-file
  */
-void OggPlayer::debug()
+void OggPlayer::debug() const
 {
   cout
@@ -368,5 +394,5 @@
 
 
-void OggPlayer::printState()
+void OggPlayer::printState() const
 {
   PRINTF(0)("OggPlayer is in the following States: ");
@@ -393,5 +419,5 @@
  * @return the error as a String
  */
-const char* OggPlayer::errorString(int code)
+const char* OggPlayer::getVorbisError(int code)
 {
   switch(code)
