#include <Airports/runways.hxx>
#include <Navaids/navlist.hxx>
#include <Main/util.hxx>
+#include <Sound/morse.hxx>
using std::string;
_sgr = smgr->find("avionics", true);
_sgr->tie_to_listener();
- morse.init();
-
SGPropertyNode* node = _radio_node.get();
bus_power_node =
fgGetNode(("/systems/electrical/outputs/" + _name).c_str(), true);
}
last_time = now;
- play_count = ++play_count % NUM_IDENT_SLOTS;
+ play_count++;
+ play_count %= NUM_IDENT_SLOTS;
// Previous ident is out of time; if still playing, cut it off:
_sgr->stop( nav_fx_name );
_navaid = nav;
string identBuffer(4, ' ');
if (nav) {
- _dme = globals->get_dmelist()->findByFreq(freq, pos);
+ // use ILS signals as DME, otherwise search by frequency
+ if (nav->type()==FGPositioned::ILS)
+ _dme = nav;
+ else
+ _dme = globals->get_dmelist()->findByFreq(freq, pos);
nav_id_node->setStringValue(nav->get_ident());
identBuffer = simgear::strutils::rpad( nav->ident(), 4, ' ' );
try {
string trans_ident(_navaid->get_trans_ident());
- SGSoundSample* sound = morse.make_ident(trans_ident, LO_FREQUENCY);
+ SGSoundSample* sound = FGMorse::instance()->make_ident(trans_ident, LO_FREQUENCY);
sound->set_volume( 0.3 );
if (!_sgr->add( sound, nav_fx_name )) {
SG_LOG(SG_COCKPIT, SG_WARN, "Failed to add v1-vor-ident sound");
_sgr->remove( dme_fx_name );
}
- sound = morse.make_ident( trans_ident, HI_FREQUENCY );
+ sound = FGMorse::instance()->make_ident( trans_ident, HI_FREQUENCY );
sound->set_volume( 0.3 );
_sgr->add( sound, dme_fx_name );