Index: trunk/src/lib/sound/sound_engine.cc
===================================================================
--- trunk/src/lib/sound/sound_engine.cc	(revision 7283)
+++ trunk/src/lib/sound/sound_engine.cc	(revision 7284)
@@ -99,4 +99,6 @@
 {
   MultiType channels = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_AUDIO_CHANNELS, "32");
+  printf("==== THIS IS A TEST ");
+  channels.debug();
   this->maxSourceCount = channels.getInt();
 
@@ -138,16 +140,13 @@
 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();
-      this->ALSources.pop();
-    }
-  }
+  assert (source == 0);
+
+  /// @TODO try to create more sources if needed
+  if (!this->ALSources.empty())
+  {
+    source = this->ALSources.top();
+    this->ALSources.pop();
+  }
+
 }
 
@@ -272,29 +271,29 @@
 bool SoundEngine::initAudio()
 {
-//   ALenum result;
-//   PRINTF(3)("Initialisazing openAL sound engine\n");
-//   const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
-//   const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER);
-//   const char* devWalk = deviceList;
-//   //  if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
-//   { // try out enumeration extension
-//     PRINTF(3)("Enumeration-extension found\n");
-//
-//     PRINTF(3)("Default device: %s\n", defaultDevice);
-//     do
-//     {
-//       PRINTF(3)("%s\n", devWalk);
-//       devWalk += strlen(devWalk)+1;
-//     }
-//     while (devWalk[0] != '\0');
-//  }
+  //   ALenum result;
+  //   PRINTF(3)("Initialisazing openAL sound engine\n");
+  //   const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
+  //   const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER);
+  //   const char* devWalk = deviceList;
+  //   //  if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
+  //   { // try out enumeration extension
+  //     PRINTF(3)("Enumeration-extension found\n");
+  //
+  //     PRINTF(3)("Default device: %s\n", defaultDevice);
+  //     do
+  //     {
+  //       PRINTF(3)("%s\n", devWalk);
+  //       devWalk += strlen(devWalk)+1;
+  //     }
+  //     while (devWalk[0] != '\0');
+  //  }
 
   // INITIALIZING THE DEVICE:
-//   char deviceName[] =
-//   #ifdef __WIN32__
-//     "Direct3D";
-//   #else
-//     "'( ( devices '( native null ) ) )";
-//   #endif
+  //   char deviceName[] =
+  //   #ifdef __WIN32__
+  //     "Direct3D";
+  //   #else
+  //     "'( ( devices '( native null ) ) )";
+  //   #endif
 
   this->device = alcOpenDevice(NULL);
@@ -312,4 +311,5 @@
   // #endif
 
+  printf ("===== SOURCECOUNT: %d\n", this->maxSourceCount);
   this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY);
   this->allocateSources(this->maxSourceCount);
@@ -409,5 +409,5 @@
 {
   switch(err)
-    {
+  {
     case ALC_NO_ERROR:
       return ("AL_NO_ERROR");
@@ -422,5 +422,5 @@
     case ALC_OUT_OF_MEMORY:
       return("ALC_OUT_OF_MEMORY");
-    };
-}
-
+  };
+}
+
Index: trunk/src/lib/sound/sound_source.cc
===================================================================
--- trunk/src/lib/sound/sound_source.cc	(revision 7283)
+++ trunk/src/lib/sound/sound_source.cc	(revision 7284)
@@ -68,4 +68,5 @@
   if (unlikely(this->sourceID == 0))
     SoundEngine::getInstance()->popALSource(this->sourceID);
+  assert (this->sourceID != 0);
 
   alSourceStop(this->sourceID);
@@ -76,4 +77,6 @@
     alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
   this->bPlay = true;
+  printf("%d\n", this->sourceID);
+
 }
 
Index: trunk/src/lib/util/multi_type.cc
===================================================================
--- trunk/src/lib/util/multi_type.cc	(revision 7283)
+++ trunk/src/lib/util/multi_type.cc	(revision 7284)
@@ -296,11 +296,8 @@
   else if (this->type & MT_STRING)
   {
-    if (this->storedString == "") return 0;
-    char* endPtr = NULL;
-    int result = strtol(this->storedString.c_str(), &endPtr, 10);
-    if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str()))
-      return 0;
-    else
-      return result;
+    std::stringstream ssStream(this->storedString);
+    int iReturn;
+    ssStream >> iReturn;
+    return iReturn;
   }
   return 0;
@@ -323,5 +320,5 @@
     char* endPtr = NULL;
     double result = strtod(this->storedString.c_str(), &endPtr);
-    if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str()))
+    if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + this->storedString.size())
       return 0.0f;
     else
