]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/soundmanager.cxx
Interim windows build fix
[flightgear.git] / src / Sound / soundmanager.cxx
index a4c197ce9c8da8ad5177005459af9aba99aa2192..bb1b83418bf07e252fe9604148e82ffe92d90b5f 100644 (file)
@@ -23,6 +23,9 @@
 
 #include <simgear/sound/soundmgr_openal.hxx>
 
+#if defined(ENABLE_FLITE)
+#include "VoiceSynthesizer.hxx"
+#endif
 #include "soundmanager.hxx"
 #include "Main/globals.hxx"
 #include "Main/fg_props.hxx"
@@ -68,9 +71,10 @@ void FGSoundManager::init()
     _device_name   = fgGetNode("/sim/sound/device-name");
 
     _currentView   = fgGetNode("sim/current-view");
-    _viewPosLon    = fgGetNode("sim/current-view/viewer-lon-deg");
-    _viewPosLat    = fgGetNode("sim/current-view/viewer-lat-deg");
-    _viewPosElev   = fgGetNode("sim/current-view/viewer-elev-ft");
+
+    _viewX = _currentView->getNode("viewer-x-m", true);
+    _viewY = _currentView->getNode("viewer-y-m", true);
+    _viewZ = _currentView->getNode("viewer-z-m", true);
   
     _velocityNorthFPS = fgGetNode("velocities/speed-north-fps", true);
     _velocityEastFPS  = fgGetNode("velocities/speed-east-fps", true);
@@ -91,6 +95,8 @@ void FGSoundManager::shutdown()
     SGPropertyNode_ptr scenery_loaded = fgGetNode("sim/sceneryloaded", true);
     scenery_loaded->removeChangeListener(_listener.get());
     
+    stop();
+    
     SGSoundMgr::shutdown();
 }
 
@@ -167,12 +173,12 @@ void FGSoundManager::update(double dt)
         }
         if (enabled)
         {
-            SGGeod viewPosGeod(SGGeod::fromDegFt(_viewPosLon->getDoubleValue(),
-                                                 _viewPosLat->getDoubleValue(),
-                                                 _viewPosElev->getDoubleValue()));
-            SGVec3d cartPos = SGVec3d::fromGeod(viewPosGeod);
+            SGVec3d cartPos(_viewX->getDoubleValue(),
+                            _viewY->getDoubleValue(),
+                            _viewZ->getDoubleValue());
+            SGGeod geodPos = SGGeod::fromCart(cartPos);
 
-            set_position(cartPos, viewPosGeod);
+            set_position(cartPos, geodPos);
 
             SGQuatd viewOrientation;
             for (int i=0; i<4; ++i) {
@@ -196,4 +202,16 @@ void FGSoundManager::update(double dt)
     }
 }
 
+#if defined(ENABLE_FLITE)
+VoiceSynthesizer * FGSoundManager::getSynthesizer( const std::string & voice )
+{
+  std::map<std::string,VoiceSynthesizer*>::iterator it = _synthesizers.find(voice);
+  if( it == _synthesizers.end() ) {
+    VoiceSynthesizer * synthesizer = new FLITEVoiceSynthesizer( voice );
+    _synthesizers[voice] = synthesizer;
+    return synthesizer;
+  }
+  return it->second;
+}
+#endif
 #endif // ENABLE_AUDIO_SUPPORT