Index: trunk/src/lib/sound/ogg_player.cc
===================================================================
--- trunk/src/lib/sound/ogg_player.cc	(revision 6827)
+++ trunk/src/lib/sound/ogg_player.cc	(revision 6828)
@@ -50,36 +50,36 @@
 void OggPlayer::open(const char* fileName)
 {
-    int result;
-
-    if(!(oggFile = fopen(fileName, "rb")))
-        PRINTF(2)("Could not open Ogg file.");
-
-    if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
-    {
-        fclose(oggFile);
-
-        PRINTF(2)("Could not open Ogg stream. %s", errorString(result));
-    }
-
-    vorbisInfo = ov_info(&oggStream, -1);
-    vorbisComment = ov_comment(&oggStream, -1);
-
-    if(vorbisInfo->channels == 1)
-        format = AL_FORMAT_MONO16;
-    else
-        format = AL_FORMAT_STEREO16;
-
-
-    alGenBuffers(2, buffers);
-    check();
-    SoundEngine::getInstance()->popALSource(this->source);
-    check();
-
-    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());
+  int result;
+
+  if(!(oggFile = fopen(fileName, "rb")))
+    PRINTF(2)("Could not open Ogg file.");
+
+  if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
+  {
+    fclose(oggFile);
+
+    PRINTF(2)("Could not open Ogg stream. %s", errorString(result));
+  }
+
+  vorbisInfo = ov_info(&oggStream, -1);
+  vorbisComment = ov_comment(&oggStream, -1);
+
+  if(vorbisInfo->channels == 1)
+    format = AL_FORMAT_MONO16;
+  else
+    format = AL_FORMAT_STEREO16;
+
+
+  alGenBuffers(2, buffers);
+  check();
+  SoundEngine::getInstance()->popALSource(this->source);
+  check();
+
+  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());
 }
 
@@ -89,34 +89,12 @@
 void OggPlayer::release()
 {
-    alSourceStop(source);
-    empty();
-    SoundEngine::getInstance()->pushALSource(source);
-    check();
-    alDeleteBuffers(1, buffers);
-    check();
-
-    ov_clear(&oggStream);
-}
-
-/**
- * displays some info about the ogg-file
- */
-void OggPlayer::display()
-{
-    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;
+  alSourceStop(source);
+  empty();
+  SoundEngine::getInstance()->pushALSource(source);
+  check();
+  alDeleteBuffers(1, buffers);
+  check();
+
+  ov_clear(&oggStream);
 }
 
@@ -128,17 +106,17 @@
 bool OggPlayer::playback()
 {
-    if(playing())
-        return true;
-
-    if(!stream(buffers[0]))
-        return false;
-
-    if(!stream(buffers[1]))
-        return false;
-
-    alSourceQueueBuffers(source, 2, buffers);
-    alSourcePlay(source);
-
+  if(playing())
     return true;
+
+  if(!stream(buffers[0]))
+    return false;
+
+  if(!stream(buffers[1]))
+    return false;
+
+  alSourceQueueBuffers(source, 2, buffers);
+  alSourcePlay(source);
+
+  return true;
 }
 
@@ -149,9 +127,9 @@
 bool OggPlayer::playing()
 {
-    ALenum state;
-
-    alGetSourcei(source, AL_SOURCE_STATE, &state);
-
-    return (state == AL_PLAYING);
+  ALenum state;
+
+  alGetSourcei(this->source, AL_SOURCE_STATE, &state);
+
+  return (state == AL_PLAYING);
 }
 
@@ -162,23 +140,23 @@
 bool OggPlayer::update()
 {
-    int processed;
-    bool active = true;
-
-    alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
-
-    while(processed--)
-    {
-        ALuint buffer;
-
-        alSourceUnqueueBuffers(source, 1, &buffer);
-        check();
-
-        active = stream(buffer);
-
-        alSourceQueueBuffers(source, 1, &buffer);
-        check();
-    }
-
-    return active;
+  int processed;
+  bool active = true;
+
+  alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
+
+  while(processed--)
+  {
+    ALuint buffer;
+
+    alSourceUnqueueBuffers(source, 1, &buffer);
+    check();
+
+    active = stream(buffer);
+
+    alSourceQueueBuffers(source, 1, &buffer);
+    check();
+  }
+
+  return active;
 }
 
@@ -190,48 +168,48 @@
 bool OggPlayer::stream(ALuint buffer)
 {
-    char pcm[BUFFER_SIZE];
-    int  size = 0;
-    int  section;
-    int  result;
-
-    while(size < BUFFER_SIZE)
-    {
-        result = ov_read(&oggStream, pcm + size, BUFFER_SIZE - size, 0, 2, 1, &section);
-
-        if(result > 0)
-            size += result;
-        else
-            if(result < 0)
-                throw errorString(result);
-            else
-                break;
-    }
-
-    if(size == 0)
-        return false;
-
-    alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
+  char pcm[BUFFER_SIZE];
+  int  size = 0;
+  int  section;
+  int  result;
+
+  while(size < BUFFER_SIZE)
+  {
+    result = ov_read(&oggStream, pcm + size, BUFFER_SIZE - size, 0, 2, 1, &section);
+
+    if(result > 0)
+      size += result;
+    else
+      if(result < 0)
+        throw errorString(result);
+      else
+        break;
+  }
+
+  if(size == 0)
+    return false;
+
+  alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
+  check();
+
+  return true;
+}
+
+
+/**
+ * empties the buffers
+ */
+void OggPlayer::empty()
+{
+  int queued;
+
+  alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
+
+  while(queued--)
+  {
+    ALuint buffer;
+
+    alSourceUnqueueBuffers(source, 1, &buffer);
     check();
-
-    return true;
-}
-
-
-/**
- * empties the buffers
- */
-void OggPlayer::empty()
-{
-    int queued;
-
-    alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
-
-    while(queued--)
-    {
-        ALuint buffer;
-
-        alSourceUnqueueBuffers(source, 1, &buffer);
-        check();
-    }
+  }
 }
 
@@ -241,9 +219,34 @@
 void OggPlayer::check()
 {
-        int error = alGetError();
-
-        if(error != AL_NO_ERROR)
-                PRINTF(2)("OpenAL error was raised.");
-}
+  int error = alGetError();
+
+  if(error != AL_NO_ERROR)
+    PRINTF(2)("OpenAL error was raised.");
+}
+
+
+
+/**
+ * displays some info about the ogg-file
+ */
+void OggPlayer::debug()
+{
+  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;
+}
+
 
 /**
@@ -254,18 +257,18 @@
 const char* OggPlayer::errorString(int code)
 {
-     switch(code)
-     {
-       case OV_EREAD:
-         return ("Read from media.");
-       case OV_ENOTVORBIS:
-         return ("Not Vorbis data.");
-       case OV_EVERSION:
-         return ("Vorbis version mismatch.");
-       case OV_EBADHEADER:
-         return ("Invalid Vorbis header.");
-       case OV_EFAULT:
-         return ("Internal logic fault (bug or heap/stack corruption.");
-       default:
-         return ("Unknown Ogg error.");
-     }
-}
+  switch(code)
+  {
+    case OV_EREAD:
+      return ("Read from media.");
+    case OV_ENOTVORBIS:
+      return ("Not Vorbis data.");
+    case OV_EVERSION:
+      return ("Vorbis version mismatch.");
+    case OV_EBADHEADER:
+      return ("Invalid Vorbis header.");
+    case OV_EFAULT:
+      return ("Internal logic fault (bug or heap/stack corruption.");
+    default:
+      return ("Unknown Ogg error.");
+  }
+}
Index: trunk/src/lib/sound/ogg_player.h
===================================================================
--- trunk/src/lib/sound/ogg_player.h	(revision 6827)
+++ trunk/src/lib/sound/ogg_player.h	(revision 6828)
@@ -31,5 +31,5 @@
     void open(const char* fileName);
     void release();
-    void display();
+    void debug();
     bool playback();
     bool playing();
