Index: branches/new_class_id/src/lib/sound/sound_engine.cc
===================================================================
--- branches/new_class_id/src/lib/sound/sound_engine.cc	(revision 9683)
+++ branches/new_class_id/src/lib/sound/sound_engine.cc	(revision 9686)
@@ -20,6 +20,4 @@
 
 #include "sound_engine.h"
-
-#include "class_list.h"
 
 #include "p_node.h"
@@ -31,5 +29,5 @@
 namespace OrxSound
 {
-
+  NewObjectListDefinition(SoundEngine);
   //////////////////
   /* SOUND-ENGINE */
@@ -40,10 +38,8 @@
   SoundEngine::SoundEngine ()
   {
-    this->setClassID(CL_SOUND_ENGINE, "SoundEngine");
+    this->registerObject(this, SoundEngine::_objectList);
     this->setName("SoundEngine");
 
     this->listener = NULL;
-    this->bufferList = NULL;
-    this->sourceList = NULL;
 
     this->device = NULL;
@@ -69,9 +65,6 @@
   {
     // deleting all the SoundSources
-    if(this->sourceList != NULL)
-    {
-      while (this->sourceList->size() > 0)
-        delete static_cast<SoundSource*>(this->sourceList->front());
-    }
+    while (!SoundSource::objectList().empty())
+      delete (SoundSource::objectList().front());
 
     while(!this->ALSources.empty())
@@ -89,9 +82,6 @@
 
     // deleting all the SoundBuffers
-    if (this->bufferList != NULL)
-    {
-      while(this->bufferList->size() > 0)
-        ResourceManager::getInstance()->unload(static_cast<SoundBuffer*>(this->bufferList->front()));
-    }
+    while(!SoundBuffer::objectList().empty())
+      ResourceManager::getInstance()->unload(SoundBuffer::objectList().front());
 
     // removing openAL from AudioResource
@@ -212,39 +202,36 @@
 
     // updating all the Sources positions
-    if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL))
-    {
-      std::list<BaseObject*>::const_iterator sourceIT;
-      SoundSource* source;
-      for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
+    NewObjectList<SoundSource>::const_iterator sourceIT;
+    for (sourceIT = SoundSource::objectList().begin();
+         sourceIT != SoundSource::objectList().end();
+         sourceIT++)
+    {
+      if ((*sourceIT)->isPlaying())
       {
-        source = static_cast<SoundSource*>(*sourceIT);
-        if (source->isPlaying())
+        int play = 0x000;
+        alGetSourcei((*sourceIT)->getID(), AL_SOURCE_STATE, &play);
+        if (DEBUG_LEVEL > 2)
+          SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
+        if(play == AL_PLAYING)
         {
-          int play = 0x000;
-          alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
-          if (DEBUG_LEVEL > 2)
-            SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
-          if(play == AL_PLAYING)
+	  if (likely((*sourceIT)->getNode() != NULL))
           {
-            if (likely(source->getNode() != NULL))
-            {
-              alSource3f(source->getID(), AL_POSITION,
-                         source->getNode()->getAbsCoor().x,
-                         source->getNode()->getAbsCoor().y,
-                         source->getNode()->getAbsCoor().z);
-              if (DEBUG_LEVEL > 2)
-                SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
-              alSource3f(source->getID(), AL_VELOCITY,
-                         source->getNode()->getVelocity().x,
-                         source->getNode()->getVelocity().y,
-                         source->getNode()->getVelocity().z);
-              if (DEBUG_LEVEL > 2)
-                SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
-            }
+            alSource3f((*sourceIT)->getID(), AL_POSITION,
+                       (*sourceIT)->getNode()->getAbsCoor().x,
+                       (*sourceIT)->getNode()->getAbsCoor().y,
+                       (*sourceIT)->getNode()->getAbsCoor().z);
+            if (DEBUG_LEVEL > 2)
+              SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
+            alSource3f((*sourceIT)->getID(), AL_VELOCITY,
+                       (*sourceIT)->getNode()->getVelocity().x,
+                       (*sourceIT)->getNode()->getVelocity().y,
+                       (*sourceIT)->getNode()->getVelocity().z);
+            if (DEBUG_LEVEL > 2)
+              SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
           }
-          else
-          {
-            source->stop();
-          }
+        }
+        else
+        {
+          (*sourceIT)->stop();
         }
       }
@@ -393,15 +380,15 @@
       default:
       case AL_NO_ERROR:
-        return ("AL_NO_ERROR");
+      return ("AL_NO_ERROR");
       case AL_INVALID_NAME:
-        return ("AL_INVALID_NAME");
+      return ("AL_INVALID_NAME");
       case AL_INVALID_ENUM:
-        return ("AL_INVALID_ENUM");
+      return ("AL_INVALID_ENUM");
       case AL_INVALID_VALUE:
-        return ("AL_INVALID_VALUE");
+      return ("AL_INVALID_VALUE");
       case AL_INVALID_OPERATION:
-        return ("AL_INVALID_OPERATION");
+      return ("AL_INVALID_OPERATION");
       case AL_OUT_OF_MEMORY:
-        return ("AL_OUT_OF_MEMORY");
+      return ("AL_OUT_OF_MEMORY");
     };
   }
@@ -414,15 +401,15 @@
       default:
       case ALC_NO_ERROR:
-        return ("AL_NO_ERROR");
+      return ("AL_NO_ERROR");
       case ALC_INVALID_DEVICE:
-        return ("ALC_INVALID_DEVICE");
+      return ("ALC_INVALID_DEVICE");
       case ALC_INVALID_CONTEXT:
-        return("ALC_INVALID_CONTEXT");
+      return("ALC_INVALID_CONTEXT");
       case ALC_INVALID_ENUM:
-        return("ALC_INVALID_ENUM");
+      return("ALC_INVALID_ENUM");
       case ALC_INVALID_VALUE:
-        return ("ALC_INVALID_VALUE");
+      return ("ALC_INVALID_VALUE");
       case ALC_OUT_OF_MEMORY:
-        return("ALC_OUT_OF_MEMORY");
+      return("ALC_OUT_OF_MEMORY");
     };
   }
