[Orxonox-commit 392] r2982 - in branches/sound/src/orxonox: objects/items sound

erwin at orxonox.net erwin at orxonox.net
Mon May 18 15:38:23 CEST 2009


Author: erwin
Date: 2009-05-18 15:38:22 +0200 (Mon, 18 May 2009)
New Revision: 2982

Modified:
   branches/sound/src/orxonox/objects/items/Engine.cc
   branches/sound/src/orxonox/sound/SoundManager.cc
Log:
added some error checking

Modified: branches/sound/src/orxonox/objects/items/Engine.cc
===================================================================
--- branches/sound/src/orxonox/objects/items/Engine.cc	2009-05-18 12:46:12 UTC (rev 2981)
+++ branches/sound/src/orxonox/objects/items/Engine.cc	2009-05-18 13:38:22 UTC (rev 2982)
@@ -77,6 +77,9 @@
             if (this->boostBlur_)
                 delete this->boostBlur_;
         }
+
+        if(this->sound_ != NULL)
+            delete this->sound_;
     }
 
     void Engine::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -221,8 +224,10 @@
     void Engine::addToSpaceShip(SpaceShip* ship)
     {
         this->ship_ = ship;
-        this->sound_->attachToEntity(ship);
 
+        if(this->sound_ != NULL)
+            this->sound_->attachToEntity(ship);
+
         if (ship)
         {
             this->shipID_ = ship->getObjectID();

Modified: branches/sound/src/orxonox/sound/SoundManager.cc
===================================================================
--- branches/sound/src/orxonox/sound/SoundManager.cc	2009-05-18 12:46:12 UTC (rev 2981)
+++ branches/sound/src/orxonox/sound/SoundManager.cc	2009-05-18 13:38:22 UTC (rev 2982)
@@ -63,16 +63,16 @@
             }
             else
             {
-                COUT(3) << "OpenAL: Sound device opened";
+                COUT(3) << "OpenAL: Sound device opened" << std::endl;
                 this->context_ = alcCreateContext(SoundManager::device_s, NULL);
                 if(this->context_ == NULL)
                 {
-                    COUT(2) << "OpenAL: Could not create sound context";
+                    COUT(2) << "OpenAL: Could not create sound context" << std::endl;
                 }
                 else
                 {
-                    COUT(3) << "OpenAL: Context " << this->context_ << "loaded";
-                    alcMakeContextCurrent(this->context_);
+                    if(alcMakeContextCurrent(this->context_) == AL_TRUE)
+                        COUT(3) << "OpenAL: Context " << this->context_ << "loaded" << std::endl;
                 }
             }
         }




More information about the Orxonox-commit mailing list