]> git.mxchange.org Git - flightgear.git/commitdiff
allow reinitializing the sound system by setting /sim/sound/working to false at runtime.
authorehofman <ehofman>
Sat, 10 Apr 2010 09:37:22 +0000 (09:37 +0000)
committerTim Moore <timoore33@gmail.com>
Mon, 12 Apr 2010 08:01:28 +0000 (10:01 +0200)
src/Main/main.cxx

index 8ac54aa5695984ea8d671a3e80b50954dad03b14..210434a7b5366d9696fd97ea7988bdafdc3409c4 100644 (file)
@@ -485,8 +485,8 @@ static void fgMainLoop( void ) {
     // is processing the scenery (doubled the frame-rate for me) -EMH-
 #ifdef ENABLE_AUDIO_SUPPORT
     static bool smgr_init = true;
+    static SGPropertyNode *sound_working = fgGetNode("/sim/sound/working");
     if (smgr_init == true) {
-        static SGPropertyNode *sound_working = fgGetNode("/sim/sound/working");
         if (sound_working->getBoolValue() == true) {
             fgInitSoundManager();
             smgr_init = false;
@@ -496,6 +496,11 @@ static void fgMainLoop( void ) {
         static SGSoundMgr *smgr = globals->get_soundmgr();
         static bool smgr_enabled = true;
 
+        if (sound_working->getBoolValue() == false) {  // request to reinit
+           smgr->reinit();
+           sound_working->setBoolValue(true);
+        }
+
         if (smgr_enabled != sound_enabled->getBoolValue()) {
             if (smgr_enabled == true) { // request to suspend
                 smgr->suspend();