[Orxonox-commit 1655] r6373 - in code/branches/presentation2/src: libraries/core libraries/util orxonox/sound
rgrieder at orxonox.net
rgrieder at orxonox.net
Thu Dec 17 23:27:00 CET 2009
Author: rgrieder
Date: 2009-12-17 23:27:00 +0100 (Thu, 17 Dec 2009)
New Revision: 6373
Modified:
code/branches/presentation2/src/libraries/core/ScopedSingletonManager.h
code/branches/presentation2/src/libraries/util/Exception.h
code/branches/presentation2/src/orxonox/sound/SoundManager.cc
Log:
Added config value to disable sound entirely.
Also added InitialisationAbortedException to be used by singletons in order not to be constructed, but nicely telling the user (only for those singletons who are allowed to fail!).
Modified: code/branches/presentation2/src/libraries/core/ScopedSingletonManager.h
===================================================================
--- code/branches/presentation2/src/libraries/core/ScopedSingletonManager.h 2009-12-17 15:52:45 UTC (rev 6372)
+++ code/branches/presentation2/src/libraries/core/ScopedSingletonManager.h 2009-12-17 22:27:00 UTC (rev 6373)
@@ -161,6 +161,8 @@
assert(singletonPtr_ == NULL);
try
{ singletonPtr_ = new T(); }
+ catch (const InitialisationAbortedException& ex)
+ { COUT(3) << ex.getDescription() << std::endl; }
catch (...)
{ COUT(1) << "Singleton creation failed: " << Exception::handleMessage() << std::endl; }
}
Modified: code/branches/presentation2/src/libraries/util/Exception.h
===================================================================
--- code/branches/presentation2/src/libraries/util/Exception.h 2009-12-17 15:52:45 UTC (rev 6372)
+++ code/branches/presentation2/src/libraries/util/Exception.h 2009-12-17 22:27:00 UTC (rev 6373)
@@ -130,6 +130,7 @@
CREATE_ORXONOX_EXCEPTION(ParseError);
CREATE_ORXONOX_EXCEPTION(PluginsNotFound);
CREATE_ORXONOX_EXCEPTION(InitialisationFailed);
+ CREATE_ORXONOX_EXCEPTION(InitialisationAborted);
CREATE_ORXONOX_EXCEPTION(NotImplemented);
CREATE_ORXONOX_EXCEPTION(GameState);
CREATE_ORXONOX_EXCEPTION(NoGraphics);
Modified: code/branches/presentation2/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/SoundManager.cc 2009-12-17 15:52:45 UTC (rev 6372)
+++ code/branches/presentation2/src/orxonox/sound/SoundManager.cc 2009-12-17 22:27:00 UTC (rev 6373)
@@ -69,6 +69,12 @@
{
RegisterRootObject(SoundManager);
+ // See whether we even want to load
+ bool bDisableSound_ = false;
+ SetConfigValue(bDisableSound_, false);
+ if (bDisableSound_)
+ ThrowException(InitialisationAborted, "Sound: Not loading at all");
+
if (!alutInitWithoutContext(NULL, NULL))
ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit);
More information about the Orxonox-commit
mailing list