]> git.mxchange.org Git - flightgear.git/commitdiff
Cleaned up a few things relating to playing morse audio vor/ils idents.
authorcurt <curt>
Mon, 12 Mar 2001 12:40:18 +0000 (12:40 +0000)
committercurt <curt>
Mon, 12 Mar 2001 12:40:18 +0000 (12:40 +0000)
src/Cockpit/radiostack.cxx
src/Cockpit/radiostack.hxx
src/Navaids/ils.hxx
src/Navaids/nav.hxx
src/Sound/soundmgr.cxx

index 4c5bef2489b0112b0974d12baf203385a2405670..e706317b7cff008b442da6f8ad5b0498d8d45a8d 100644 (file)
@@ -259,7 +259,13 @@ FGRadioStack::update()
        } else {
            nav1_radial = nav1_sel_radial;
        }
+    } else {
+       nav1_inrange = false;
+       nav1_dme_dist = 0.0;
+       // cout << "not picking up vor. :-(" << endl;
+    }
 
+    if ( nav1_valid && nav1_inrange ) {
        // play station ident via audio system if on + ident,
        // otherwise turn it off
        if ( nav1_on_btn && nav1_ident_btn ) {
@@ -286,12 +292,6 @@ FGRadioStack::update()
            globals->get_soundmgr()->stop( "nav1-vor-ident" );
            globals->get_soundmgr()->stop( "nav1-dme-ident" );
        }
-    } else {
-       nav1_inrange = false;
-       nav1_dme_dist = 0.0;
-       globals->get_soundmgr()->stop( "nav1-vor-ident" );
-       globals->get_soundmgr()->stop( "nav1-dme-ident" );
-       // cout << "not picking up vor. :-(" << endl;
     }
 
     if ( nav2_valid ) {
@@ -380,6 +380,7 @@ void FGRadioStack::search()
     if ( current_ilslist->query( lon, lat, elev, nav1_freq, &ils ) ) {
        nav1_ident = ils.get_locident();
        if ( last_nav1_ident != nav1_ident ) {
+           nav1_trans_ident = ils.get_trans_ident();
            last_nav1_ident = nav1_ident;
            nav1_valid = true;
            nav1_loc = true;
@@ -413,14 +414,14 @@ void FGRadioStack::search()
                globals->get_soundmgr()->remove( "nav1-vor-ident" );
            }
            FGSimpleSound *sound;
-           sound = morse.make_ident( nav1_ident, LO_FREQUENCY );
+           sound = morse.make_ident( nav1_trans_ident, LO_FREQUENCY );
            sound->set_volume( 0.3 );
            globals->get_soundmgr()->add( sound, "nav1-vor-ident" );
 
            if ( globals->get_soundmgr()->exists( "nav1-dme-ident" ) ) {
                globals->get_soundmgr()->remove( "nav1-dme-ident" );
            }
-           sound = morse.make_ident( nav1_ident, HI_FREQUENCY );
+           sound = morse.make_ident( nav1_trans_ident, HI_FREQUENCY );
            sound->set_volume( 0.3 );
            globals->get_soundmgr()->add( sound, "nav1-dme-ident" );
 
@@ -439,6 +440,7 @@ void FGRadioStack::search()
        nav1_ident = nav.get_ident();
        if ( last_nav1_ident != nav1_ident ) {
            last_nav1_ident = nav1_ident;
+           nav1_trans_ident = nav.get_trans_ident();
            nav1_valid = true;
            nav1_loc = false;
            nav1_has_dme = nav.get_has_dme();
@@ -459,14 +461,14 @@ void FGRadioStack::search()
                globals->get_soundmgr()->remove( "nav1-vor-ident" );
            }
            FGSimpleSound *sound;
-           sound = morse.make_ident( nav1_ident, LO_FREQUENCY );
+           sound = morse.make_ident( nav1_trans_ident, LO_FREQUENCY );
            sound->set_volume( 0.3 );
            globals->get_soundmgr()->add( sound, "nav1-vor-ident" );
 
            if ( globals->get_soundmgr()->exists( "nav1-dme-ident" ) ) {
                globals->get_soundmgr()->remove( "nav1-dme-ident" );
            }
-           sound = morse.make_ident( nav1_ident, HI_FREQUENCY );
+           sound = morse.make_ident( nav1_trans_ident, HI_FREQUENCY );
            sound->set_volume( 0.3 );
            globals->get_soundmgr()->add( sound, "nav1-dme-ident" );
 
@@ -495,6 +497,7 @@ void FGRadioStack::search()
        nav2_ident = ils.get_locident();
        if ( last_nav2_ident != nav2_ident ) {
            last_nav2_ident = nav2_ident;
+           nav2_trans_ident = ils.get_trans_ident();
            nav2_valid = true;
            nav2_loc = true;
            nav2_has_dme = ils.get_has_dme();
@@ -525,6 +528,7 @@ void FGRadioStack::search()
        nav2_ident = nav.get_ident();
        if ( last_nav2_ident != nav2_ident ) {
            last_nav2_ident = nav2_ident;
+           nav2_trans_ident = nav.get_trans_ident();
            nav2_valid = true;
            nav2_loc = false;
            nav2_has_dme = nav.get_has_dme();
index aa9f28d383f0dc42f4255cb013361c823b75f910..0cfafd968f896a228fc2e1611bfac31d85746210 100644 (file)
@@ -46,6 +46,7 @@ class FGRadioStack : public FGSubsystem
     bool need_update;
 
     string nav1_ident;
+    string nav1_trans_ident;
     bool nav1_valid;
     bool nav1_inrange;
     bool nav1_has_dme;
@@ -82,6 +83,7 @@ class FGRadioStack : public FGSubsystem
     bool nav1_ident_btn;
 
     string nav2_ident;
+    string nav2_trans_ident;
     bool nav2_valid;
     bool nav2_inrange;
     bool nav2_has_dme;
index 6eedeb1c7ce6fcb8217acbae4e30e139a9ae389c..601ffb4cb4cf0e698d946f764694aeb788d2e23c 100644 (file)
@@ -53,7 +53,7 @@ class FGILS {
     char aptcode[5];
     char rwyno[4];
     int  locfreq;
-    char locident[5];
+    char locident[5];          // official ident
     double locheading;
     double loclat;
     double loclon;
@@ -75,6 +75,12 @@ class FGILS {
     double imlat;
     double imlon;
 
+    // for failure modeling
+    string trans_ident;                // transmitted ident
+    bool loc_failed;           // localizer failed?
+    bool gs_failed;            // glide slope failed?
+    bool dme_failed;           // dme failed?
+
 public:
 
     inline FGILS(void) {}
@@ -86,6 +92,7 @@ public:
     inline char *get_rwyno() { return rwyno; }
     inline int get_locfreq() const { return locfreq; }
     inline char *get_locident() { return locident; }
+    inline string get_trans_ident() { return trans_ident; }
     inline double get_locheading() const { return locheading; }
     inline double get_loclat() const { return loclat; }
     inline double get_loclon() const { return loclon; }
@@ -167,7 +174,11 @@ operator >> ( istream& in, FGILS& i )
        // cout << "dme = " << cart << endl;
     }
 
-     // return in >> skipeol;
+    i.trans_ident = "I";
+    i.trans_ident += i.locident;
+    i.loc_failed = i.gs_failed = i.dme_failed = false;
+   
+    // return in >> skipeol;
     return in;
 }
 
index 23e1fc0153bc76155b63c271fe6b6595c6234820..97a7f24815296a60901e223bcedb2f6a7fd847af 100644 (file)
@@ -59,6 +59,11 @@ class FGNav {
     string ident;              // to avoid a core dump with corrupt data
     double magvar;             // magvar from true north (negative = W)
 
+    // for failure modeling
+    string trans_ident;                // transmitted ident
+    bool nav_failed;           // nav failed?
+    bool dme_failed;           // dme failed?
+
 public:
 
     inline FGNav(void) {}
@@ -75,6 +80,7 @@ public:
     inline int get_range() const { return range; }
     inline bool get_has_dme() const { return has_dme; }
     inline const char *get_ident() { return ident.c_str(); }
+    inline string get_trans_ident() { return trans_ident; }
     inline double get_magvar () const { return magvar; }
 
     /* inline void set_type( char t ) { type = t; }
@@ -156,6 +162,9 @@ operator >> ( istream& in, FGNav& n )
     n.y = cart.y();
     n.z = cart.z();
 
+    n.trans_ident = n.ident;
+    n.nav_failed = n.dme_failed = false;
+
     return in >> skipeol;
 }
 
index a868dd13c50494f7c42165624c48f0163000c561..24d3154b61d4f1e59d81234f496df6eee4b0a223 100644 (file)
@@ -129,23 +129,6 @@ bool FGSoundMgr::add( FGSimpleSound *sound, const string& refname  ) {
 // remove a sound effect, return true if successful
 bool FGSoundMgr::remove( const string& refname ) {
 
-#if defined ( PLIB_AUDIO_IS_BROKEN )
-    // if PLIB_AUDIO_IS_BROKEN, we can't reliably remove sounds that
-    // are currently being played. :-( So, let's just not remove them
-    // and return false.  The effects of this are that the sound
-    // sample will continue to finish playing (or continue to loop
-    // forever.)  And the sound sample will remain registered in the
-    // plib audio system.  This is a memory leak, and eventually this
-    // could cause us to max out the total number of allowed sound
-    // samples in plib, but what are you going to do?  Hopefully the
-    // plib team will do a new stable relase with these problems
-    // fixed.
-
-    cout << "plib broken audio, skipping remove" << endl;
-
-    return false;
-#endif
-
     sound_map_iterator it = sounds.find( refname );
     if ( it != sounds.end() ) {
        // first stop the sound from playing (so we don't bomb the