[Orxonox-commit 1479] r6197 - in code/branches/presentation2/src: libraries/core orxonox/sound

dafrick at orxonox.net dafrick at orxonox.net
Wed Dec 2 14:58:20 CET 2009


Author: dafrick
Date: 2009-12-02 14:58:20 +0100 (Wed, 02 Dec 2009)
New Revision: 6197

Modified:
   code/branches/presentation2/src/libraries/core/ConfigFileManager.cc
   code/branches/presentation2/src/libraries/core/ConfigFileManager.h
   code/branches/presentation2/src/orxonox/sound/SoundManager.cc
Log:
Small adjustments, better code re-use, added getConfig() function to get values of config values.

Modified: code/branches/presentation2/src/libraries/core/ConfigFileManager.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/ConfigFileManager.cc	2009-12-02 13:42:56 UTC (rev 6196)
+++ code/branches/presentation2/src/libraries/core/ConfigFileManager.cc	2009-12-02 13:58:20 UTC (rev 6197)
@@ -56,6 +56,11 @@
         }
         return false;
     }
+    
+    std::string getConfig(const std::string& classname, const std::string& varname)
+    {
+        return ConfigFileManager::getInstance().getValue(ConfigFileType::Settings, classname, varname, "", true);
+    }
 
     bool tconfig(const std::string& classname, const std::string& varname, const std::string& value)
     {

Modified: code/branches/presentation2/src/libraries/core/ConfigFileManager.h
===================================================================
--- code/branches/presentation2/src/libraries/core/ConfigFileManager.h	2009-12-02 13:42:56 UTC (rev 6196)
+++ code/branches/presentation2/src/libraries/core/ConfigFileManager.h	2009-12-02 13:58:20 UTC (rev 6197)
@@ -56,6 +56,7 @@
     };
 
     _CoreExport bool config(const std::string& classname, const std::string& varname, const std::string& value); // tolua_export
+    _CoreExport std::string getConfig(const std::string& classname, const std::string& varname); // tolua_export
     _CoreExport bool tconfig(const std::string& classname, const std::string& varname, const std::string& value);
     _CoreExport void reloadConfig();
     _CoreExport void saveConfig();

Modified: code/branches/presentation2/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/SoundManager.cc	2009-12-02 13:42:56 UTC (rev 6196)
+++ code/branches/presentation2/src/orxonox/sound/SoundManager.cc	2009-12-02 13:58:20 UTC (rev 6197)
@@ -162,58 +162,27 @@
     
     void SoundManager::checkSoundVolumeValidity()
     {
-        if(this->soundVolume_ < 0.0 || this->soundVolume_ > 1.0)
+        if(!checkVolumeValidity(SoundType::none))
         {
-            COUT(2) << "Sound warning: Sound volume out of range, ignoring change." << std::endl;
             ResetConfigValue(soundVolume_);
         }
-        
-        this->updateVolume(SoundType::none);
-        COUT(3) << "SoundManager: volume set to " << this->soundVolume_ << std::endl;
-            
     }
     
     void SoundManager::checkAmbientVolumeValidity()
     {
-        if(this->ambientVolume_ < 0.0 || this->ambientVolume_ > 1.0)
+        if(!checkVolumeValidity(SoundType::ambient))
         {
-            COUT(2) << "Sound warning: Sound volume out of range, ignoring change." << std::endl;
             ResetConfigValue(ambientVolume_);
         }
-        
-        this->updateVolume(SoundType::ambient);
-        COUT(3) << "SoundManager: volume set to " << this->ambientVolume_ << std::endl;
     }
     
     void SoundManager::checkEffectsVolumeValidity()
     {
-        if(this->effectsVolume_ < 0.0 || this->effectsVolume_ > 1.0)
+        if(!checkVolumeValidity(SoundType::effects))
         {
-            COUT(2) << "Sound warning: Sound volume out of range, ignoring change." << std::endl;
             ResetConfigValue(effectsVolume_);
         }
-        
-        this->updateVolume(SoundType::effects);
-        COUT(3) << "SoundManager: volume set to " << this->effectsVolume_ << std::endl;
     }
-    
-//     void SoundManager::checkSoundVolumeValidity()
-//     {
-//         if(!checkVolumeValidity(SoundType::none))
-//             ResetConfigValue(soundVolume_)
-//     }
-//     
-//     void SoundManager::checkAmbientVolumeValidity()
-//     {
-//         if(!checkVolumeValidity(SoundType::ambient))
-//             ResetConfigValue(ambientVolume_);
-//     }
-//     
-//     void SoundManager::checkEffectsVolumeValidity()
-//     {
-//         if(!checkVolumeValidity(SoundType::effects))
-//             ResetConfigValue(effectsVolume_);
-//     }
 
     void SoundManager::setListenerPosition(const Vector3& position)
     {




More information about the Orxonox-commit mailing list