Index: /orxonox/branches/soundEngine/src/Makefile.am
===================================================================
--- /orxonox/branches/soundEngine/src/Makefile.am	(revision 3508)
+++ /orxonox/branches/soundEngine/src/Makefile.am	(revision 3509)
@@ -61,5 +61,6 @@
 		 glmenu/glmenu_imagescreen.cc 
 
-sound_SOURCES = sound_control.cc
+sound_SOURCES =  sound_test.cc \
+		 sound_control.cc
 
 noinst_HEADERS = orxonox.h \
Index: /orxonox/branches/soundEngine/src/Makefile.in
===================================================================
--- /orxonox/branches/soundEngine/src/Makefile.in	(revision 3508)
+++ /orxonox/branches/soundEngine/src/Makefile.in	(revision 3509)
@@ -16,5 +16,5 @@
 
 
-SOURCES = $(orxonox_SOURCES)
+SOURCES = $(orxonox_SOURCES) $(sound_SOURCES)
 
 srcdir = @srcdir@
@@ -39,5 +39,5 @@
 POST_UNINSTALL = :
 host_triplet = @host@
-bin_PROGRAMS = orxonox$(EXEEXT)
+bin_PROGRAMS = orxonox$(EXEEXT) sound$(EXEEXT)
 subdir = src
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
@@ -67,4 +67,7 @@
 orxonox_OBJECTS = $(am_orxonox_OBJECTS)
 orxonox_LDADD = $(LDADD)
+am_sound_OBJECTS = sound_test.$(OBJEXT) sound_control.$(OBJEXT)
+sound_OBJECTS = $(am_sound_OBJECTS)
+sound_LDADD = $(LDADD)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -87,4 +90,6 @@
 @AMDEP_TRUE@	./$(DEPDIR)/p_node.Po ./$(DEPDIR)/player.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/skysphere.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/sound_control.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/sound_test.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/track_manager.Po ./$(DEPDIR)/vector.Po \
@@ -95,6 +100,6 @@
 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
-SOURCES = $(orxonox_SOURCES)
-DIST_SOURCES = $(orxonox_SOURCES)
+SOURCES = $(orxonox_SOURCES) $(sound_SOURCES)
+DIST_SOURCES = $(orxonox_SOURCES) $(sound_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
@@ -251,4 +256,7 @@
 		 glmenu/glmenu_imagescreen.cc 
 
+sound_SOURCES = sound_test.cc \
+		 sound_control.cc
+
 noinst_HEADERS = orxonox.h \
 		 game_loader.h \
@@ -359,4 +367,7 @@
 	@rm -f orxonox$(EXEEXT)
 	$(CXXLINK) $(orxonox_LDFLAGS) $(orxonox_OBJECTS) $(orxonox_LDADD) $(LIBS)
+sound$(EXEEXT): $(sound_OBJECTS) $(sound_DEPENDENCIES) 
+	@rm -f sound$(EXEEXT)
+	$(CXXLINK) $(sound_LDFLAGS) $(sound_OBJECTS) $(sound_LDADD) $(LIBS)
 
 mostlyclean-compile:
@@ -393,4 +404,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound_control.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@
Index: /orxonox/branches/soundEngine/src/sound_control.cc
===================================================================
--- /orxonox/branches/soundEngine/src/sound_control.cc	(revision 3508)
+++ /orxonox/branches/soundEngine/src/sound_control.cc	(revision 3509)
@@ -18,16 +18,6 @@
 using namespace std;
 
-int sfx_channel1 = -1;
-int sfx_channel2 = -1;
-int finished = 0;
 SoundControl* SoundControl::sound = SoundControl::getInstance();
-SoundControl* SoundControl::singletonRef = 0;
-int volume = SDL_MIX_MAXVOLUME;
-int track_number = 1;
-Mix_Music* music = NULL;
-int audio_rate = 44100, audio_channels = MIX_DEFAULT_CHANNELS, 
-audio_buffers = 16384, bits = 0; 
-Uint16 audio_format = MIX_DEFAULT_FORMAT;
-SDL_Event event;
+SoundControl* SoundControl::singletonRef = NULL;
 
 
@@ -37,5 +27,5 @@
     All sound output is handled by this singleton object.
 */ 
-SoundControl::SoundControl() { 
+SoundControl::SoundControl() {
   if(SDL_Init(SDL_INIT_AUDIO)<0) {
     printf("SDL_Init: INIT_AUDIO error.\n"); 
@@ -44,5 +34,5 @@
     printf("Mix_OpenAudio: Failed to open audio!\n"); 
   } 
-  initialise();
+  init();
 }
 
@@ -50,5 +40,7 @@
     \brief Default destructor 
 */ 
-SoundControl::~SoundControl() {
+SoundControl::~SoundControl() 
+{
+  singletonRef = NULL;
 }
 
@@ -57,5 +49,5 @@
 */
 SoundControl* SoundControl::getInstance() {
-  if (!SoundControl::singletonRef) 
+  if (SoundControl::singletonRef) 
     return singletonRef;
   else
@@ -66,5 +58,19 @@
     \brief Is called by SoundControl object to initiate all values and to output some text
 */ 
-void SoundControl::initialise() { 
+void SoundControl::init(void) 
+{ 
+  this->sfx_channel1 = -1;
+  this->sfx_channel2 = -1;
+  this->finished = 0;
+  this->volume = SDL_MIX_MAXVOLUME;
+  this->track_number = 1;
+  this->music = NULL;
+  this->audio_rate = 44100;
+  this->audio_channels = MIX_DEFAULT_CHANNELS;
+  this->audio_buffers = 16384;
+  this->bits = 0; 
+  this->audio_format = MIX_DEFAULT_FORMAT;
+  
+  
   Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); 
   bits=audio_format&0xFF; 
@@ -85,6 +91,5 @@
 */ 
 void SoundControl::playMod(char* fileName) {
-  Mix_Chunk* chunk = NULL; 
-  chunk = Mix_LoadWAV(fileName); 
+  Mix_Chunk* chunk = Mix_LoadWAV(fileName); 
   if(Mix_PlayChannel(-1, chunk, 0) == -1) {
     printf("Mix_PlayChannel: %s\n", Mix_GetError());
@@ -97,6 +102,5 @@
 */ 
 void SoundControl::playWav(char* fileName) {
-  Mix_Chunk* chunk = NULL; 
-  chunk = Mix_LoadWAV(fileName); 
+  Mix_Chunk* chunk = Mix_LoadWAV(fileName); 
   if(Mix_PlayChannel(-1, chunk, 0) == -1) {
     printf("Mix_PlayChannel: %s\n", Mix_GetError());
@@ -188,5 +192,7 @@
     \brief Hooked by playOgg at end of .ogg playback
 */ 
-void SoundControl::musicDone() {
+void SoundControl::musicDone()
+{
+  Mix_Music* music = SoundControl::getInstance()->music;
   Mix_HaltMusic();
   Mix_FreeMusic(music);
@@ -194,68 +200,2 @@
 } 
 
-/** 
-    \brief Handles input events
-*/ 
-void SoundControl::handleKey(SDL_KeyboardEvent key) {
-  SoundControl* sound = SoundControl::getInstance();
-
-  switch(key.keysym.sym) {
-  case SDLK_a:
-    if(key.type == SDL_KEYDOWN) {
-      if(sound->sfx_channel1 < 0) {
-	sound->sfx_channel1 = 1;
-	sound->playWav("sound1.wav");
-      }
-    } else {
-      Mix_HaltChannel(sound->sfx_channel1);
-      sound->sfx_channel1 = -1;
-    }
-    break;
-  case SDLK_s:
-    if(key.type == SDL_KEYDOWN) {
-      if(sound->sfx_channel2 < 0) {
-	sound->sfx_channel2 = 1;
-	sound->playWav("sound2.wav");
-      }
-    } else {
-      Mix_HaltChannel(sound->sfx_channel2);
-      sound->sfx_channel2 = -1;
-    }
-    break;
-  case SDLK_m:
-    if(key.state == SDL_PRESSED) {
-      sound->playOgg("music.ogg");
-    }
-    break;
-  case SDLK_q:
-    sound->finished = 1;
-    break;
-  default:
-    break;
-  }
-}
-
-int main(int argc, char* argv[]) {
-  SDL_Surface* screen;
-  SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO); 
-  screen = SDL_SetVideoMode(320, 240, 0, 0);
-  while(!finished) {
-    while(SDL_PollEvent(&event)) {
-      switch(event.type) {
-      case SDL_QUIT:
-	finished = 1;
-	break;
-      case SDL_KEYDOWN:
-      case SDL_KEYUP:
-	SoundControl::handleKey(event.key);
-	break;
-      default:
-	break;
-      }
-    }
-    SDL_Delay(50);
-  }
-  delete SoundControl::getInstance();
-  SDL_Quit();
-  return 0;
-}
Index: /orxonox/branches/soundEngine/src/sound_control.h
===================================================================
--- /orxonox/branches/soundEngine/src/sound_control.h	(revision 3508)
+++ /orxonox/branches/soundEngine/src/sound_control.h	(revision 3509)
@@ -30,5 +30,15 @@
   int main(int argc, char* argv[]);
   
+
+ private:
+  SoundControl();
+  void init(void);
+
+  static SoundControl* singletonRef;
+
+ public:
+  Mix_Music* music;
   static SoundControl* sound;
+  int bits;
   int volume;
   int track_number;
@@ -39,11 +49,4 @@
   int sfx_channel2;
   int finished;
-
- private:
-  SoundControl();
-
-  static SoundControl* singletonRef;
-  void initialise();
-
 };
 
Index: /orxonox/branches/soundEngine/src/sound_test.cc
===================================================================
--- /orxonox/branches/soundEngine/src/sound_test.cc	(revision 3509)
+++ /orxonox/branches/soundEngine/src/sound_test.cc	(revision 3509)
@@ -0,0 +1,75 @@
+
+
+#include "sound_control.h"
+
+
+/** 
+    \brief Handles input events
+*/ 
+void handleKey(SDL_KeyboardEvent key) {
+  SoundControl* sound = SoundControl::getInstance();
+
+  switch(key.keysym.sym) {
+  case SDLK_a:
+    if(key.type == SDL_KEYDOWN) {
+      if(sound->sfx_channel1 < 0) {
+	sound->sfx_channel1 = 1;
+	sound->playWav("sound1.wav");
+      }
+    } else {
+      Mix_HaltChannel(sound->sfx_channel1);
+      sound->sfx_channel1 = -1;
+    }
+    break;
+  case SDLK_s:
+    if(key.type == SDL_KEYDOWN) {
+      if(sound->sfx_channel2 < 0) {
+	sound->sfx_channel2 = 1;
+	sound->playWav("sound2.wav");
+      }
+    } else {
+      Mix_HaltChannel(sound->sfx_channel2);
+      sound->sfx_channel2 = -1;
+    }
+    break;
+  case SDLK_m:
+    if(key.state == SDL_PRESSED) {
+      sound->playOgg("music.ogg");
+    }
+    break;
+  case SDLK_q:
+    sound->finished = 1;
+    break;
+  default:
+    break;
+  }
+}
+
+int main(int argc, char* argv[]) {
+  SDL_Surface* screen;
+  SDL_Event event;
+  SoundControl* soundControl = SoundControl::getInstance();
+
+  SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+  screen = SDL_SetVideoMode(320, 240, 0, 0);
+  while(!soundControl->finished) {
+    while(SDL_PollEvent(&event)) {
+      switch(event.type) {
+      case SDL_QUIT:
+	soundControl->finished = 1;
+	break;
+      case SDL_KEYDOWN:
+      case SDL_KEYUP:
+	handleKey(event.key);
+	break;
+      default:
+	break;
+      }
+    }
+    SDL_Delay(50);
+  }
+  delete SoundControl::getInstance();
+  SDL_Quit();
+  return 0;
+}
+
