]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/marker_beacon.cxx
Fix line endings
[flightgear.git] / src / Instrumentation / marker_beacon.cxx
index 175eac49b82d201a834aad1e8ebd287b1dcad7b0..910efc56d865bbaadf3513c0b5fecd346252707b 100644 (file)
@@ -46,7 +46,8 @@ FGMarkerBeacon::FGMarkerBeacon(SGPropertyNode *node) :
     middle_blink(false),
     inner_blink(false),
     name("marker-beacon"),
-    num(0)
+    num(0),
+    _time_before_search_sec(0.0)
 {
     SGPath path( globals->get_fg_root() );
     SGPath term = path;
@@ -97,6 +98,7 @@ FGMarkerBeacon::init ()
 
     SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
     // Inputs
+    sound_pause = fgGetNode("/sim/sound/pause", false);
     lon_node = fgGetNode("/position/longitude-deg", true);
     lat_node = fgGetNode("/position/latitude-deg", true);
     alt_node = fgGetNode("/position/altitude-ft", true);
@@ -150,7 +152,8 @@ FGMarkerBeacon::update(double dt)
 {
     need_update = false;
 
-    if ( has_power() && serviceable->getBoolValue() ) {
+    if ( has_power() && serviceable->getBoolValue()
+            && !sound_pause->getBoolValue()) {
 
        // On timeout, scan again
        _time_before_search_sec -= dt;
@@ -290,8 +293,10 @@ void FGMarkerBeacon::search()
         if ( last_beacon != OUTER ) {
             if ( ! globals->get_soundmgr()->exists( "outer-marker" ) ) {
                 SGSoundSample *sound = beacon.get_outer();
-                sound->set_volume( 0.3 );
-                globals->get_soundmgr()->add( sound, "outer-marker" );
+                if ( sound ) {
+                    sound->set_volume( 0.3 );
+                    globals->get_soundmgr()->add( sound, "outer-marker" );
+                }
             }
         }
         if ( audio_btn->getBoolValue() ) {
@@ -307,8 +312,10 @@ void FGMarkerBeacon::search()
        if ( last_beacon != MIDDLE ) {
            if ( ! globals->get_soundmgr()->exists( "middle-marker" ) ) {
                SGSoundSample *sound = beacon.get_middle();
-               sound->set_volume( 0.3 );
-               globals->get_soundmgr()->add( sound, "middle-marker" );
+                if ( sound ) {
+                   sound->set_volume( 0.3 );
+                   globals->get_soundmgr()->add( sound, "middle-marker" );
+                }
            }
         }
         if ( audio_btn->getBoolValue() ) {
@@ -324,8 +331,10 @@ void FGMarkerBeacon::search()
        if ( last_beacon != INNER ) {
            if ( ! globals->get_soundmgr()->exists( "inner-marker" ) ) {
                SGSoundSample *sound = beacon.get_inner();
-               sound->set_volume( 0.3 );
-               globals->get_soundmgr()->add( sound, "inner-marker" );
+                if ( sound ) {
+                   sound->set_volume( 0.3 );
+                   globals->get_soundmgr()->add( sound, "inner-marker" );
+                }
            }
         }
         if ( audio_btn->getBoolValue() ) {