Index: branches/powerups/src/lib/sound/sound_buffer.cc
===================================================================
--- branches/powerups/src/lib/sound/sound_buffer.cc	(revision 5871)
+++ branches/powerups/src/lib/sound/sound_buffer.cc	(revision 5955)
@@ -20,7 +20,5 @@
 #include "sound_engine.h"
 
-
 using namespace std;
-
 
 //////////////////
@@ -36,6 +34,4 @@
   this->setName(fileName);
 
-  SoundEngine::getInstance()->addBuffer(this);
-
   ALenum format;
   ALvoid* data;
@@ -47,5 +43,5 @@
   alGenBuffers(1, &this->bufferID);
   if ((result = alGetError()) != AL_NO_ERROR)
-    SoundEngine::PrintALErrorString(result);
+    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
 
   // read in the wav data
@@ -59,15 +55,15 @@
 #endif
   if ((result = alGetError()) != AL_NO_ERROR)
-    SoundEngine::PrintALErrorString(result);
+    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
 
   // send the loaded wav data to the buffer
   alBufferData(this->bufferID, format, data, this->size, freq);
   if ((result = alGetError()) != AL_NO_ERROR)
-    SoundEngine::PrintALErrorString(result);
+    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
 
   // remove the wav data (redundant)
   alutUnloadWAV(format, data, this->size, freq);
   if ((result = alGetError()) != AL_NO_ERROR)
-    SoundEngine::PrintALErrorString(result);
+    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
 }
 
Index: branches/powerups/src/lib/sound/sound_engine.cc
===================================================================
--- branches/powerups/src/lib/sound/sound_engine.cc	(revision 5871)
+++ branches/powerups/src/lib/sound/sound_engine.cc	(revision 5955)
@@ -27,5 +27,5 @@
 #include "resource_manager.h"
 #include "debug.h"
-#include "ini_parser.h"
+#include "parser/ini_parser/ini_parser.h"
 #include "globals.h"
 
@@ -47,4 +47,9 @@
   this->bufferList = NULL;
   this->sourceList = NULL;
+
+  this->device = NULL;
+  this->context = NULL;
+
+  this->maxSourceCount = 32;
 }
 
@@ -64,4 +69,10 @@
     while (this->sourceList->size() > 0)
       delete dynamic_cast<SoundSource*>(this->sourceList->front());
+  }
+
+  while(!this->ALSources.empty())
+  {
+    alDeleteSources(1, &this->ALSources.top());
+    this->ALSources.pop();
   }
 
@@ -86,4 +97,6 @@
 void SoundEngine::loadSettings(IniParser* iniParser)
 {
+  const char* channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32");
+  this->maxSourceCount = atoi(channels);
   const char* musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "80");
   this->musicVolume = atof(musicVolume)/100.0;
@@ -118,40 +131,22 @@
 
 
-/**
- *  adds a SoundBuffer to the bufferList of the SoundEngine
- * @param buffer The buffer to add to the bufferList
-*/
-void SoundEngine::addBuffer(SoundBuffer* buffer)
-{
-  if (unlikely(this->bufferList == NULL))
-    this->bufferList = ClassList::getList(CL_SOUND_BUFFER);
-}
-
-/**
- *  removes a SoundBuffer from the bufferList of the SoundEngine
- * @param buffer The buffer to delete from the SoundEngine
-*/
-void SoundEngine::removeBuffer(SoundBuffer* buffer)
-{
-  // look if there are any sources that have the buffer still loaded
-  if (this->sourceList != NULL)
-  {
-    list<BaseObject*>::iterator source;
-    for (source = this->sourceList->begin(); source != this->sourceList->end(); source++)
-    {
-      if (buffer == static_cast<SoundSource*>(*source)->getBuffer())
-        delete (*source);
+void SoundEngine::popALSource(ALuint& source)
+{
+  if (source != 0)
+    return;
+  else
+  {
+
+    /// @TODO try to create more sources if needed
+    if (!this->ALSources.empty())
+    {
+
+      source = this->ALSources.top();
+      printf("test: : %d\n", source);
+      this->ALSources.pop();
     }
   }
 }
 
-/**
- * adds a SoundSource to the sourceList of the SoundEngine
- * @param source The source to add to the sourceList
-*/
-void SoundEngine::addSource(SoundSource* source)
-{
-  this->sourceList = ClassList::getList(CL_SOUND_SOURCE);
-}
 
 /**
@@ -180,21 +175,34 @@
 
   // updating all the Sources positions
-  if (likely(this->sourceList != NULL))
-  {
-    list<BaseObject*>::iterator sourceIT;
+  if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL))
+  {
+    list<BaseObject*>::const_iterator sourceIT;
     SoundSource* source;
     for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
     {
       source = static_cast<SoundSource*>(*sourceIT);
-      if (likely(source->getNode() != NULL))
+      if (source->isPlaying())
       {
-        alSource3f(source->getID(), AL_POSITION,
-                   source->getNode()->getAbsCoor().x,
-                   source->getNode()->getAbsCoor().y,
-                   source->getNode()->getAbsCoor().z);
-        alSource3f(source->getID(), AL_VELOCITY,
-                   source->getNode()->getVelocity().x,
-                   source->getNode()->getVelocity().y,
-                   source->getNode()->getVelocity().z);
+        int play;
+        alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
+        if(play == AL_PLAYING)
+        {
+          if (likely(source->getNode() != NULL))
+          {
+            alSource3f(source->getID(), AL_POSITION,
+                       source->getNode()->getAbsCoor().x,
+                       source->getNode()->getAbsCoor().y,
+                       source->getNode()->getAbsCoor().z);
+            alSource3f(source->getID(), AL_VELOCITY,
+                       source->getNode()->getVelocity().x,
+                       source->getNode()->getVelocity().y,
+                       source->getNode()->getVelocity().z);
+          }
+
+        }
+        else
+        {
+          source->stop();
+        }
       }
     }
@@ -281,9 +289,13 @@
 
   // INITIALIZING THE DEVICE:
+#ifndef AL_VERSION_1_1
   ALubyte deviceName[] =
+#else
+  ALCchar deviceName[] =
+#endif
 #ifdef __WIN32__
-      "native";
+      "Direct3D";
 #else
-      "'( ( devices '( native arts null ) ) )";
+      "'( ( devices '( native null ) ) )";
 #endif
   //
@@ -296,7 +308,33 @@
 
   if ((result = alGetError()) != AL_NO_ERROR)
-    SoundEngine::PrintALErrorString(result);
+    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
 
   this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY);
+}
+
+
+/**
+ * Allocates openAL sources
+ * @param count how many sources to allocate
+ * @returns true on success, false if at least one source could not be allocated
+ */
+bool SoundEngine::allocateSources(unsigned int count)
+{
+  ALenum result;
+  // Setting default values.
+  for (unsigned int i = 0; i < count; i++)
+  {
+    ALuint source;
+
+    alGenSources(1, &source);
+    if ((result = alGetError()) != AL_NO_ERROR)
+      PRINTF(1)("Error Generating Sources: '%s'\n", SoundEngine::getALErrorString(result));
+
+    alSourcef (source, AL_PITCH,    1.0      );
+    alSourcef (source, AL_GAIN,     this->getEffectsVolume() );
+    alSourcei (source, AL_LOOPING,  AL_FALSE );
+    this->ALSources.push(source);
+  }
+  return true;
 }
 
@@ -305,31 +343,20 @@
  * @param err The error found
 */
-void SoundEngine::PrintALErrorString(ALenum err)
+const char* SoundEngine::getALErrorString(ALenum err)
 {
   switch(err)
     {
     case AL_NO_ERROR:
-      PRINTF(4)("AL_NO_ERROR\n");
-      break;
-
+      return ("AL_NO_ERROR");
     case AL_INVALID_NAME:
-      PRINTF(2)("AL_INVALID_NAME\n");
-      break;
-
+      return ("AL_INVALID_NAME");
     case AL_INVALID_ENUM:
-      PRINTF(2)("AL_INVALID_ENUM\n");
-      break;
-
+      return ("AL_INVALID_ENUM");
     case AL_INVALID_VALUE:
-      PRINTF(2)("AL_INVALID_VALUE\n");
-      break;
-
+      return ("AL_INVALID_VALUE");
     case AL_INVALID_OPERATION:
-      PRINTF(2)("AL_INVALID_OPERATION\n");
-      break;
-
+      return ("AL_INVALID_OPERATION");
     case AL_OUT_OF_MEMORY:
-      PRINTF(2)("AL_OUT_OF_MEMORY\n");
-      break;
+      return ("AL_OUT_OF_MEMORY");
     };
 }
@@ -337,5 +364,4 @@
 void SoundEngine::listDevices()
 {
-
   printf("%s\n",(const char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER));
 }
Index: branches/powerups/src/lib/sound/sound_engine.h
===================================================================
--- branches/powerups/src/lib/sound/sound_engine.h	(revision 5871)
+++ branches/powerups/src/lib/sound/sound_engine.h	(revision 5955)
@@ -14,4 +14,5 @@
 
 #include <list>
+#include <stack>
 
 #define SOUND_DOPPLER_FACTOR       0.001          //!< A factor for the audible doppler effect
@@ -22,7 +23,7 @@
 class IniParser;
 
+
 //! A class that handles audio via the openAudioLibrary
 class SoundEngine : public BaseObject {
-
   public:
     virtual ~SoundEngine();
@@ -47,36 +48,37 @@
 
   // administrative
-    void addBuffer(SoundBuffer* buffer);
-    void removeBuffer(SoundBuffer* buffer);
-    void addSource(SoundSource* source);
+    void popALSource(ALuint& source);
+    void pushALSource(ALuint& source) { if (source != 0) this->ALSources.push(source); };
 
     void flushUnusedBuffers();
     void flushAllBuffers();
     void flushAllSources();
+
     bool initAudio();
+    bool allocateSources(unsigned int count);
 
   // error handling:
-    static void PrintALErrorString(ALenum err);
-  //  static void PrintALCErrorString(ALenum err);
-
+    static const char* getALErrorString(ALenum err);
 
   private:
     SoundEngine();
+
     void listDevices();
 
   private:
-    static SoundEngine*      singletonRef;             //!< Reference to this class
+    static SoundEngine*            singletonRef;             //!< Reference to this class
 
-    ALCdevice*               device;                   //!< the used audio-device.
-    ALCcontext*              context;                  //!< the context, currently in use.
+    ALCdevice*                     device;                   //!< the used audio-device.
+    ALCcontext*                    context;                  //!< the context, currently in use.
 
-    float                    musicVolume;              //!< the maximum volume of the music in % (0f,1f]
-    float                    effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
-    PNode*                   listener;                 //!< The listener of the Scene
+    float                          musicVolume;              //!< the maximum volume of the music in % (0f,1f]
+    float                          effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
+    PNode*                         listener;                 //!< The listener of the Scene
 
-    std::list<BaseObject*>*  bufferList;               //!< A list of buffers
-    std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
+    const std::list<BaseObject*>*  bufferList;               //!< A list of buffers
+    const std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
 
-
+    unsigned int                   maxSourceCount;           //!< How many Sources is the Maximum
+    std::stack<ALuint>             ALSources;                //!< A list of real openAL-Sources, the engine allocates, and stores for reuse.
 };
 
Index: branches/powerups/src/lib/sound/sound_source.cc
===================================================================
--- branches/powerups/src/lib/sound/sound_source.cc	(revision 5871)
+++ branches/powerups/src/lib/sound/sound_source.cc	(revision 5955)
@@ -18,4 +18,5 @@
 #include "sound_source.h"
 #include "sound_engine.h"
+
 #include "alincl.h"
 #include "compiler.h"
@@ -33,17 +34,9 @@
 
   // adding the Source to the SourcesList of the SoundEngine
-  SoundEngine::getInstance()->addSource(this);
-
   this->buffer = buffer;
   this->sourceNode = sourceNode;
 
-  alGenSources(1, &this->sourceID);
-  if ((result = alGetError()) != AL_NO_ERROR)
-    SoundEngine::PrintALErrorString(result);
-  if (this->buffer != NULL)
-    alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
-  alSourcef (this->sourceID, AL_PITCH,    1.0      );
-  alSourcef (this->sourceID, AL_GAIN,     SoundEngine::getInstance()->getEffectsVolume() );
-  alSourcei (sourceID, AL_LOOPING,  AL_FALSE     );
+  this->sourceID = 0;
+  this->bPlay = false;
 }
 
@@ -53,6 +46,5 @@
 SoundSource::~SoundSource()
 {
-  //SoundEngine::getInstance()->removeSource(this);
-  alDeleteSources(1, &this->sourceID);
+  SoundEngine::getInstance()->pushALSource(this->sourceID);
 }
 
@@ -62,5 +54,8 @@
 void SoundSource::play()
 {
+  if (this->sourceID == 0)
+    SoundEngine::getInstance()->popALSource(this->sourceID);
   alSourcePlay(this->sourceID);
+  this->bPlay = true;
 }
 
@@ -71,4 +66,8 @@
 void SoundSource::play(const SoundBuffer* buffer)
 {
+  if (unlikely(this->sourceID == 0))
+    SoundEngine::getInstance()->popALSource(this->sourceID);
+
+  printf("%d\n",sourceID);
   alSourceStop(this->sourceID);
   alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
@@ -77,4 +76,5 @@
   if (unlikely(this->buffer != NULL))
     alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+  this->bPlay = true;
 }
 
@@ -84,5 +84,7 @@
 void SoundSource::stop()
 {
+  this->bPlay = false;
   alSourceStop(this->sourceID);
+  SoundEngine::getInstance()->pushALSource(this->sourceID);
 }
 
Index: branches/powerups/src/lib/sound/sound_source.h
===================================================================
--- branches/powerups/src/lib/sound/sound_source.h	(revision 5871)
+++ branches/powerups/src/lib/sound/sound_source.h	(revision 5955)
@@ -31,4 +31,6 @@
     /** @returns The ID of this Source */
     inline ALuint getID() const { return this->sourceID; }
+    /** @returns true, if the Source is Playing */
+    inline bool   isPlaying() const { return this->bPlay; };
     /** @returns the SoundBuffer of this Source */
     inline const SoundBuffer* getBuffer() const { return this->buffer; }
@@ -39,4 +41,5 @@
 
   private:
+    bool                   bPlay;                 //!< If the Source is Playing.
     ALuint                 sourceID;              //!< The ID of the Source
     const SoundBuffer*     buffer;                //!< The buffer to play in this source.
