]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_commands.cxx
Merge branch 'curt/replay' into next
[flightgear.git] / src / Main / fg_commands.cxx
index ab6a15844df8542af151037960ff1efce5da0384..70ceb23b5fd3d2326c18c6fe4c9258461fdf57b7 100644 (file)
@@ -34,7 +34,7 @@
 #include <Scenery/tilemgr.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scripting/NasalSys.hxx>
-#include <Sound/fg_fx.hxx>
+#include <Sound/sample_queue.hxx>
 #include <Time/sunsolver.hxx>
 #include <Time/tmp.hxx>
 
@@ -189,7 +189,7 @@ do_exit (const SGPropertyNode * arg)
     fgSetBool("/sim/signals/exit", true);
 
     if (fgGetBool("/sim/startup/save-on-exit")) {
-#ifdef _MSC_VER
+#ifdef _WIN32
         char* envp = ::getenv( "APPDATA" );
         if ( envp != NULL ) {
             SGPath config( envp );
@@ -1254,15 +1254,20 @@ do_play_audio_sample (const SGPropertyNode * arg)
 {
     string path = arg->getStringValue("path");
     string file = arg->getStringValue("file");
-    double volume = arg->getDoubleValue("volume");
+    float volume = arg->getFloatValue("volume");
     // cout << "playing " << path << " / " << file << endl;
     try {
-        static FGFX *fx = 0;
-        if ( !fx ) {
-           SGSoundMgr *smgr = (SGSoundMgr *)globals->get_subsystem("soundmgr");
-           fx = (FGFX *)smgr->find("fx");
+        static FGSampleQueue *queue = 0;
+        if ( !queue ) {
+           SGSoundMgr *smgr = globals->get_soundmgr();
+           queue = new FGSampleQueue(smgr, "chatter");
+           queue->tie_to_listener();
         }
-        if (fx) fx->play_message( path, file, volume );
+
+        SGSoundSample *msg = new SGSoundSample(path.c_str(), file.c_str());
+        msg->set_volume( volume );
+        queue->add( msg );
+
         return true;
 
     } catch (const sg_io_exception&) {
@@ -1591,9 +1596,9 @@ static struct {
 void
 fgInitCommands ()
 {
-  SG_LOG(SG_GENERAL, SG_INFO, "Initializing basic built-in commands:");
+  SG_LOG(SG_GENERAL, SG_BULK, "Initializing basic built-in commands:");
   for (int i = 0; built_ins[i].name != 0; i++) {
-    SG_LOG(SG_GENERAL, SG_INFO, "  " << built_ins[i].name);
+    SG_LOG(SG_GENERAL, SG_BULK, "  " << built_ins[i].name);
     globals->get_commands()->addCommand(built_ins[i].name,
                                        built_ins[i].command);
   }