]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/adf.cxx
Refactor morse and beacon as singleton
[flightgear.git] / src / Instrumentation / adf.cxx
index 94171731d4c10b996173caebfe176366d78a3a94..e3fbac05332aeb61f9dc1d3a6a01f9aa9941aa8d 100644 (file)
@@ -17,6 +17,8 @@
 #include <Navaids/navlist.hxx>
 
 #include "adf.hxx"
+#include <Sound/morse.hxx>
+
 
 #include <iostream>
 #include <string>
@@ -103,12 +105,13 @@ ADF::init ()
     _ident_audible_node = node->getChild("ident-audible", 0, true);
     _power_btn_node = node->getChild("power-btn", 0, true);
 
+    if (_power_btn_node->getType() == simgear::props::NONE) 
+      _power_btn_node->setBoolValue(true); // front end didn't implement a power button
+
     SGSoundMgr *smgr = globals->get_soundmgr();
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
 
-    morse.init();
-
     std::ostringstream temp;
     temp << _name << _num;
     _adf_ident = temp.str();
@@ -249,7 +252,7 @@ ADF::search (double frequency_khz, double longitude_rad,
         }
 
         SGSoundSample *sound;
-        sound = morse.make_ident( ident, LO_FREQUENCY );
+        sound = FGMorse::instance()->make_ident( ident, LO_FREQUENCY );
         sound->set_volume(_last_volume = 0);
         _sgr->add( sound, _adf_ident );