Index: /orxonox/branches/sound/src/sound_control.cc
===================================================================
--- /orxonox/branches/sound/src/sound_control.cc	(revision 2792)
+++ /orxonox/branches/sound/src/sound_control.cc	(revision 2793)
@@ -14,5 +14,5 @@
 */
 
-#include "Sound_control.h"
+#include "sound_control.h"
 #include <string.h> 
 #include "SDL_mixer.h" 
@@ -29,5 +29,5 @@
 */ 
 SoundControl::SoundControl () { 
-  
+ 
   //setup parameters 
   int audio_rate = MIX_DEFAULT_FREQUENCY, audio_channels = MIX_DEFAULT_CHANNELS, audio_buffers = 8192, bits = 0; 
@@ -37,10 +37,10 @@
   //initializing sound and calling Mix_OpenAudio 
   if(SDL_Init(SDL_INIT_AUDIO)<0){ 
-    printf("SDL_Init:\n"); 
+    printf("SDL_Init: \n"); 
     exit(1); 
   } 
 
   if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)){ 
-    printf("Mix_OpenAudio:\n"); 
+    printf("Mix_OpenAudio: \n"); 
     exit(1); 
   } 
@@ -49,4 +49,25 @@
 }
 
+SoundControl::SoundControl (int audio_rate audiorate, Uint16 audio_format audioformat, int audio_channels audiochannels, int audio_buffers audiobuffers) { 
+  
+  //setup parameters 
+  int audio_rate = audiorate, audio_channels = audiochannels, audio_buffers = audiobuffers, bits = 0; 
+  Uint16 audio_format = audioformat; 
+  Mix_Music* music = NULL; 
+  
+  //initializing sound and calling Mix_OpenAudio 
+  if(SDL_Init(SDL_INIT_AUDIO)<0){ 
+    printf("SDL_Init: \n"); 
+    exit(1); 
+  } 
+
+  if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)){ 
+    printf("Mix_OpenAudio: \n"); 
+    exit(1); 
+  } 
+
+  postConstruction();
+}
+
 
 /** 
@@ -54,5 +75,8 @@
 */ 
 SoundControl::~SoundControl () { 
-}
+  SoundControl* SoundControl::singleton = NULL;
+}
+
+SoundControl* SoundControl::singleton = NULL;
 
 
@@ -65,6 +89,5 @@
   Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); 
   bits=audio_format&0xFF; 
-  printf("Opened audio at %d Hz %d bit %s, %d bytes audio buffer\n", audio_rate, 
-	 bits, audio_channels > 1 ? "stereo" : "mono", audio_buffers ); 
+  printf("Opened audio at %d Hz %d bit %s, %d bytes audio buffer\n", audio_rate, bits, audio_channels > 1 ? "stereo" : "mono", audio_buffers ); 
   
   int volume = SDL_MIX_MAXVOLUME;
@@ -72,14 +95,5 @@
   int track_number = 1;
   int done = 0;
-  int free = 1;
-} 
-
-
-/** 
-    \brief Returns false if a sound_control object has been made
-*/ 
-void SoundControl::isFree () { 
-  return free;
-}
+} 
 
 
@@ -96,14 +110,5 @@
     \param filename: self-explanatory 
 */ 
-void SoundControl::playMod (char* fileName) {
-
-}
-
-
-/** 
-    \brief May be called from any WorldEntity to play a .wav file 
-    \param filename: self-explanatory 
-*/ 
-void SoundControl::playWav (char* fileName) {
+int SoundControl::playMod (char* fileName) {
   Mix_Chunk* chunk = NULL; 
   chunk = Mix_LoadWAV(fileName); 
@@ -111,4 +116,17 @@
     printf("Mix_PlayChannel: %s\n", Mix_GetError());
   }
+}
+
+
+/** 
+    \brief May be called from any WorldEntity to play a .wav file 
+    \param filename: self-explanatory 
+*/ 
+int SoundControl::playWav (char* fileName) {
+  Mix_Chunk* chunk = NULL; 
+  chunk = Mix_LoadWAV(fileName); 
+  if(Mix_PlayChannel(-1, chunk, 0) == -1) {
+    printf("Mix_PlayChannel: %s\n", Mix_GetError());
+  }
 } 
 
@@ -118,5 +136,5 @@
     \param filename: self-explanatory 
 */ 
-void SoundControl::playOgg (char* fileName) {
+int SoundControl::playOgg (char* fileName) {
   Mix_Music* music = NULL;
   music = Mix_LoadMUS(fileName);
@@ -212,8 +230,10 @@
 
 /** 
-    \brief Called by playOgg 
+    \brief Hooked by playOgg at end of .ogg playback
 */ 
 void SoundControl::musicDone () {
   track_number++; 
-} 
-
+  Mix_HaltMusic();
+  Mix_FreeMusic(music);
+  music = NULL;
+} 
Index: /orxonox/branches/sound/src/sound_control.h
===================================================================
--- /orxonox/branches/sound/src/sound_control.h	(revision 2792)
+++ /orxonox/branches/sound/src/sound_control.h	(revision 2793)
@@ -1,16 +1,30 @@
-
-#ifndef PROTO_CLASS_H
-#define PROTO_CLASS_H
+#ifndef SOUNDCONTROL_CLASS_H
+#define SOUNDCONTROL_CLASS_H
 
 #include "data_tank.h"
 
-
-class ProtoClass {
+class SoundControl {
 
  public:
-  ProtoClass ();
-  ~ProtoClass ();
+  SoundControl ();
+  ~SoundControl ();
+  void setNumberOfChannels(int number_of channels);
+  int playMod(char* filename);
+  int playWav(char* filename);
+  int playOgg(char* filename);
+  void volumeUp();
+  void volumeDown();
+  void trackRewind();
+  void forwardMusic();
+  void rewindMusic();
+  void pauseMusic();
+  void resumeMusic();
+  void trackSelect();
 
-};
+private:
+  void postConstruction();
+  SoundControl* singleton;
+
+}
 
 #endif
Index: /orxonox/branches/sound/src/sound_test.cc
===================================================================
--- /orxonox/branches/sound/src/sound_test.cc	(revision 2793)
+++ /orxonox/branches/sound/src/sound_test.cc	(revision 2793)
@@ -0,0 +1,43 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Simon Hofmann
+   co-programmer:
+*/
+
+
+#include "sound_test.h"
+#include "SDL.h"
+#include "SDL_mixer.h"
+
+using namespace std;
+
+
+SoundTest::SoundTest () {
+  
+}
+
+
+SoundTest::~SoundTest () {
+  
+}
+
+
+void main (void){
+  SDL_Surface *screen;
+  SDL_Init(SDL_INIT_VIDEO); 
+  screen = SDL_SetVideoMode(320, 240, 0, 0);
+  SoundControl* sound = new SoundControl;
+  sound.SoundControl();
+  sound->playOgg(music.ogg);
+  sound.~SoundControl();
+}
+ 
Index: /orxonox/branches/sound/src/sound_test.h
===================================================================
--- /orxonox/branches/sound/src/sound_test.h	(revision 2793)
+++ /orxonox/branches/sound/src/sound_test.h	(revision 2793)
@@ -0,0 +1,16 @@
+
+#ifndef PROTO_CLASS_H
+#define PROTO_CLASS_H
+
+#include "data_tank.h"
+
+
+class ProtoClass {
+
+ public:
+  ProtoClass ();
+  ~ProtoClass ();
+
+};
+
+#endif
