]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/marker_beacon.cxx
Fixed intermittant marker beacon audio.
[flightgear.git] / src / Cockpit / marker_beacon.cxx
index 1a0d6f327c4e9882bb59fe6ab1332ea1928ee98e..1f7c7882b99654bfa97fc11a352b48aaeb1548b3 100644 (file)
 SG_USING_STD(string);
 
 
-/**
- * Boy, this is ugly!  Make the VOR range vary by altitude difference.
- */
-static double kludgeRange ( double stationElev, double aircraftElev,
-                           double nominalRange)
-{
-                               // Assume that the nominal range (usually
-                               // 50nm) applies at a 5,000 ft difference.
-                               // Just a wild guess!
-  double factor = ((aircraftElev*SG_METER_TO_FEET) - stationElev) / 5000.0;
-  double range = fabs(nominalRange * factor);
-
-                               // Clamp the range to keep it sane; for
-                               // now, never less than 25% or more than
-                               // 500% of nominal range.
-  if (range < nominalRange/4.0) {
-    range = nominalRange/4.0;
-  } else if (range > nominalRange*5.0) {
-    range = nominalRange*5.0;
-  }
-
-  return range;
-}
-
-
 // Constructor
 FGMarkerBeacon::FGMarkerBeacon() :
     lon_node(fgGetNode("/position/longitude-deg", true)),
@@ -223,10 +198,10 @@ void FGMarkerBeacon::search()
                 globals->get_soundmgr()->add( sound, "outer-marker" );
             }
         }
-        if ( audio_btn->getBoolValue() 
-             && !globals->get_soundmgr()->is_playing("outer-marker") )
-        {
-            globals->get_soundmgr()->play_looped( "outer-marker" );
+        if ( audio_btn->getBoolValue() ) {
+            if ( !globals->get_soundmgr()->is_playing("outer-marker") ) {
+                globals->get_soundmgr()->play_looped( "outer-marker" );
+            }
         } else {
             globals->get_soundmgr()->stop( "outer-marker" );
         }
@@ -240,10 +215,10 @@ void FGMarkerBeacon::search()
                globals->get_soundmgr()->add( sound, "middle-marker" );
            }
         }
-        if ( audio_btn->getBoolValue() 
-             && !globals->get_soundmgr()->is_playing("middle-marker") )
-        {
-            globals->get_soundmgr()->play_looped( "middle-marker" );
+        if ( audio_btn->getBoolValue() ) {
+            if ( !globals->get_soundmgr()->is_playing("middle-marker") ) {
+                globals->get_soundmgr()->play_looped( "middle-marker" );
+            }
         } else {
             globals->get_soundmgr()->stop( "middle-marker" );
         }
@@ -257,10 +232,10 @@ void FGMarkerBeacon::search()
                globals->get_soundmgr()->add( sound, "inner-marker" );
            }
         }
-        if ( audio_btn->getBoolValue() 
-             && !globals->get_soundmgr()->is_playing("inner-marker") )
-        {
-            globals->get_soundmgr()->play_looped( "inner-marker" );
+        if ( audio_btn->getBoolValue() ) {
+            if ( !globals->get_soundmgr()->is_playing("inner-marker") ) {
+                globals->get_soundmgr()->play_looped( "inner-marker" );
+            }
         } else {
             globals->get_soundmgr()->stop( "inner-marker" );
         }