]> git.mxchange.org Git - flightgear.git/commitdiff
update to allow selection of a new sound device
authorehofman <ehofman>
Mon, 30 Nov 2009 14:24:16 +0000 (14:24 +0000)
committerTim Moore <timoore@redhat.com>
Mon, 30 Nov 2009 21:45:33 +0000 (22:45 +0100)
src/Main/main.cxx
src/Main/options.cxx

index 07d232a80cf45e2a5883021298449a9923e7d718..ca63accb200f46d362668285efe4cf77c1460d53 100644 (file)
@@ -104,6 +104,8 @@ long global_multi_loop;
 SGTimeStamp last_time_stamp;
 SGTimeStamp current_time_stamp;
 
+void fgSetNewSoundDevice(const char *);
+
 // The atexit() function handler should know when the graphical subsystem
 // is initialized.
 extern int _bootstrap_OSInit;
@@ -509,6 +511,7 @@ static void fgMainLoop( void ) {
         } else {
             smgr->stop();
         }
+        globals->get_props()->tie("/sim/sound/device", SGRawValueFunctions<const char *>(0, fgSetNewSoundDevice), false);
     }
 
     fgRequestRedraw();
@@ -516,6 +519,14 @@ static void fgMainLoop( void ) {
     SG_LOG( SG_ALL, SG_DEBUG, "" );
 }
 
+void fgSetNewSoundDevice(const char *device)
+{
+    globals->get_soundmgr()->suspend();
+    globals->get_soundmgr()->stop();
+    globals->get_soundmgr()->init(device);
+    globals->get_soundmgr()->resume();
+}
+
 // Operation for querying OpenGL parameters. This must be done in a
 // valid OpenGL context, potentially in another thread.
 namespace
index ceca89101118ad9d04c3ec6614bb9c705967776c..e03f1b1f00929ebe7957fefff53a0ef1f361d418 100644 (file)
@@ -204,7 +204,7 @@ fgSetDefaults ()
     fgSetBool("/sim/rendering/shading", true);
     fgSetBool("/sim/rendering/skyblend", true);
     fgSetBool("/sim/rendering/textures", true);
-       fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false);
+    fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false);
     fgSetInt("/sim/rendering/filtering", 1);
     fgSetBool("/sim/rendering/wireframe", false);
     fgSetBool("/sim/rendering/horizon-effect", false);