]> git.mxchange.org Git - flightgear.git/commitdiff
add a new command line option: --show-sound-devices
authorehofman <ehofman>
Mon, 30 Nov 2009 08:42:29 +0000 (08:42 +0000)
committerTim Moore <timoore@redhat.com>
Mon, 30 Nov 2009 21:44:57 +0000 (22:44 +0100)
src/Main/options.cxx

index 2651965ff4ca035129ee4e7410b09ddc6029d886..b46424e53e71c4bc059bb4a0f0c63b6247bf4ab3 100644 (file)
@@ -45,6 +45,7 @@
 #include <simgear/misc/sgstream.hxx>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/scene/material/mat.hxx>
+#include <simgear/sound/soundmgr_openal.hxx>
 
 // #include <Include/general.hxx>
 // #include <Airports/simple.hxx>
@@ -81,7 +82,8 @@ enum
     FG_OPTIONS_ERROR = 2,
     FG_OPTIONS_EXIT = 3,
     FG_OPTIONS_VERBOSE_HELP = 4,
-    FG_OPTIONS_SHOW_AIRCRAFT = 5
+    FG_OPTIONS_SHOW_AIRCRAFT = 5,
+    FG_OPTIONS_SHOW_SOUND_DEVICES = 6
 };
 
 static double
@@ -1503,6 +1505,8 @@ parse_option (const string& arg)
         return(FG_OPTIONS_VERBOSE_HELP);
     } else if ( arg.find( "--show-aircraft") == 0) {
         return(FG_OPTIONS_SHOW_AIRCRAFT);
+    } else if ( arg.find( "--show-sound-devices") == 0) {
+        return(FG_OPTIONS_SHOW_SOUND_DEVICES);
     } else if ( arg.find( "--prop:" ) == 0 ) {
         if (!set_property(arg.substr(7))) {
             SG_LOG( SG_GENERAL, SG_ALERT, "Bad property assignment: " << arg );
@@ -1618,11 +1622,20 @@ fgParseArgs (int argc, char **argv)
               verbose = true;
 
             else if (result == FG_OPTIONS_SHOW_AIRCRAFT) {
-               fgOptLogLevel( "alert" );
-               SGPath path( globals->get_fg_root() );
-               path.append("Aircraft");
-               fgShowAircraft(path, true);
-               exit(0);
+              fgOptLogLevel( "alert" );
+              SGPath path( globals->get_fg_root() );
+              path.append("Aircraft");
+              fgShowAircraft(path, true);
+              exit(0);
+
+            } else if (result == FG_OPTIONS_SHOW_SOUND_DEVICES) {
+              SGSoundMgr smgr;
+              vector <const char*>devices = smgr.get_available_devices();
+              for (int i=0; i<devices.size(); i++) {
+                printf("%i. \"%s\"\n", i, devices[i]);
+              }
+              devices.clear();
+              exit(0);
             }
 
             else if (result == FG_OPTIONS_EXIT)