]> git.mxchange.org Git - flightgear.git/commitdiff
Use the Transmit-Render functions for tower output instead of directly calling ATCdis...
authordaveluff <daveluff>
Thu, 30 Sep 2004 15:43:32 +0000 (15:43 +0000)
committerdaveluff <daveluff>
Thu, 30 Sep 2004 15:43:32 +0000 (15:43 +0000)
src/ATC/ATC.cxx
src/ATC/ATC.hxx
src/ATC/ATCDialog.cxx
src/ATC/ATCdisplay.hxx
src/ATC/atis.cxx
src/ATC/tower.cxx

index 8634de024eb34b1fcd43c2a80129045650f0eab6..955cb8195f982a695bbd021ece95de9e4c1562a8 100644 (file)
@@ -51,6 +51,8 @@ FGATC::FGATC() {
        _transmitting = false;
        _counter = 0.0;
        _max_count = 5.0;
+       
+       _voiceOK = false;
 }
 
 FGATC::~FGATC() {
@@ -105,8 +107,9 @@ void FGATC::Update(double dt) {
                //cout << "Transmission = " << pending_transmission << '\n';
                if(_display) {
                        //Render(pending_transmission, ident, false);
+                       Render(pending_transmission);
                        // At the moment Render only works for ATIS
-                       globals->get_ATC_display()->RegisterSingleMessage(pending_transmission);
+                       //globals->get_ATC_display()->RegisterSingleMessage(pending_transmission);
                }
                // Run the callback regardless of whether on same freq as user or not.
                //cout << "_callback_code = " << _callback_code << '\n';
@@ -179,8 +182,9 @@ void FGATC::ImmediateTransmit(int callback_code) {
        SG_LOG(SG_ATC, SG_INFO, "Immediate transmit called by " << ident << " " << _type << ", msg = " << pending_transmission);
        if(_display) {
                //Render(pending_transmission, ident, false);
+               Render(pending_transmission);
                // At the moment Render doesn't work except for ATIS
-               globals->get_ATC_display()->RegisterSingleMessage(pending_transmission);
+               //globals->get_ATC_display()->RegisterSingleMessage(pending_transmission);
        }
        if(callback_code) {
                ProcessCallback(callback_code);
@@ -217,11 +221,11 @@ void FGATC::SetData(ATCData* d) {
 // The repeating flag indicates whether the message should be repeated continuously or played once.
 void FGATC::Render(string msg, string refname, bool repeating) {
        #ifdef ENABLE_AUDIO_SUPPORT
-       voice = (voiceOK && fgGetBool("/sim/sound/voice"));
-       if(voice) {
+       _voice = (_voiceOK && fgGetBool("/sim/sound/voice"));
+       if(_voice) {
                int len;
-               unsigned char* buf = vPtr->WriteMessage((char*)msg.c_str(), len, voice);
-               if(voice) {
+               unsigned char* buf = _vPtr->WriteMessage((char*)msg.c_str(), len, _voice);
+               if(_voice) {
                        SGSoundSample *simple
                             = new SGSoundSample(buf, len, 8000, false);
                        // TODO - at the moment the volume is always set off comm1 
@@ -237,23 +241,27 @@ void FGATC::Render(string msg, string refname, bool repeating) {
                delete[] buf;
        }
        #endif  // ENABLE_AUDIO_SUPPORT
-       if(!voice) {
+       if(!_voice) {
                // first rip the underscores and the pause hints out of the string - these are for the convienience of the voice parser
                for(unsigned int i = 0; i < msg.length(); ++i) {
                        if((msg.substr(i,1) == "_") || (msg.substr(i,1) == "/")) {
                                msg[i] = ' ';
                        }
                }
-               globals->get_ATC_display()->RegisterRepeatingMessage(msg);
+               if(repeating) {
+                       globals->get_ATC_display()->RegisterRepeatingMessage(msg);
+               } else {
+                       globals->get_ATC_display()->RegisterSingleMessage(msg);
+               }
        }
-       playing = true; 
+       _playing = true;        
 }
 
 
 // Cease rendering a transmission.
 void FGATC::NoRender(string refname) {
-       if(playing) {
-               if(voice) {
+       if(_playing) {
+               if(_voice) {
                        #ifdef ENABLE_AUDIO_SUPPORT             
                        globals->get_soundmgr()->stop(refname);
                        globals->get_soundmgr()->remove(refname);
@@ -261,7 +269,7 @@ void FGATC::NoRender(string refname) {
                } else {
                        globals->get_ATC_display()->CancelRepeatingMessage();
                }
-               playing = false;
+               _playing = false;
        }
 }
 
index c6c689a8d77138df00524d9d0a51397f03c0af12..cd4ab84db04ac2ffee48e571045fbb2b7dad077d 100644 (file)
@@ -180,9 +180,9 @@ protected:
        // Outputs the transmission either on screen or as audio depending on user preference
        // The refname is a string to identify this sample to the sound manager
        // The repeating flag indicates whether the message should be repeated continuously or played once.
-       void Render(string msg, string refname, bool repeating);
+       void Render(string msg, string refname = "", bool repeating = false);
        
-       // Cease rendering a transmission.
+       // Cease rendering all transmission from this station.
        // Requires the sound manager refname if audio, else "".
        void NoRender(string refname);
        
@@ -206,10 +206,10 @@ protected:
        atc_type _type;
        
        // Rendering related stuff
-       bool voice;                     // Flag - true if we are using voice
-       bool playing;           // Indicates a message in progress      
-       bool voiceOK;           // Flag - true if at least one voice has loaded OK
-       FGATCVoice* vPtr;
+       bool _voice;                    // Flag - true if we are using voice
+       bool _playing;          // Indicates a message in progress      
+       bool _voiceOK;          // Flag - true if at least one voice has loaded OK
+       FGATCVoice* _vPtr;
 
        string pending_transmission;    // derived classes set this string before calling Transmit(...) 
        bool freqClear;         // Flag to indicate if the frequency is clear of ongoing dialog
index 3946898f65eb261984b91ace0ebb65e734062abe..efcde15eb9cee1d60a69c5945afdab431bdf6f01 100644 (file)
@@ -404,6 +404,7 @@ void FGATCDialog::PopupCallback() {
                                //cout << "Doing callback...\n";
                                ATCMenuEntry a = atcmlist[atcDialogCommunicationOptions->getValue()];
                                atcptr->SetFreqInUse();
+                               // This is the user's speech getting displayed.
                                globals->get_ATC_display()->RegisterSingleMessage(atcptr->GenText(a.transmission, a.callback_code));
                                _callbackPending = true;
                                _callbackTimer = 0.0;
index 0734e446f9956d74f0a4e70b452ca82638157277..7b3ade925bce34ac4fc1f3eae6006f29505dac9b 100644 (file)
@@ -56,7 +56,7 @@ private:
     bool rep_msg;              // Flag to indicate there is a repeating transmission to display
     bool change_msg_flag;      // Flag to indicate that the repeating message has changed
     double dsp_offset1;                // Used to set the correct position of scrolling display
-    double dsp_offset2;        
+    double dsp_offset2;
     string rep_msg_str;                // The repeating transmission to play
     atcMessageList msgList;
     atcMessageListIterator msgList_itr;
index 5ed6940af97481be4d5244cbe073c41b8c7e5076..2a8780bbf30ed5118a91819fa4a0d14e4c1a7dbc 100644 (file)
@@ -56,8 +56,8 @@ FGATIS::FGATIS() :
        refname("atis")
        //type(ATIS)
 {
-       vPtr = globals->get_ATC_mgr()->GetVoicePointer(ATIS);
-       voiceOK = (vPtr == NULL ? false : true);
+       _vPtr = globals->get_ATC_mgr()->GetVoicePointer(ATIS);
+       _voiceOK = (_vPtr == NULL ? false : true);
        _type = ATIS;
 }
 
index 05f09e0b20dea9a835ea0a244086de43313eb37b..e5b632f0b8476f17a946eb97e9c73ef2f2e88245 100644 (file)
@@ -508,7 +508,9 @@ void FGTower::Respond() {
                        }
                        trns += ConvertRwyNumToSpokenString(activeRwy);
                        if(_display) {
-                               globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
+                               //globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
+                               pending_transmission = trns;
+                               Transmit();
                        } else {
                                //cout << "Not displaying, trns was " << trns << '\n';
                        }
@@ -543,7 +545,9 @@ void FGTower::Respond() {
                                string trns = t->plane.callsign;
                                trns += " hold position";
                                if(_display) {
-                                       globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
+                                       //globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
+                                       pending_transmission = trns;
+                                       Transmit();
                                }
                                // TODO - add some idea of what traffic is blocking him.
                        }
@@ -581,7 +585,9 @@ void FGTower::Respond() {
                                t->clearedToLand = false;
                        }
                        if(_display && disp) {
-                               globals->get_ATC_display()->RegisterSingleMessage(trns);
+                               //globals->get_ATC_display()->RegisterSingleMessage(trns);
+                               pending_transmission = trns;
+                               Transmit();
                        }
                        t->finalAcknowledged = true;
                } else if(t->rwyVacatedReported && !(t->rwyVacatedAcknowledged)) {
@@ -676,7 +682,9 @@ void FGTower::ProcessDownwindReport(TowerPlaneRec* t) {
                }
        }
        if(_display) {
-               globals->get_ATC_display()->RegisterSingleMessage(trns);
+               //globals->get_ATC_display()->RegisterSingleMessage(trns);
+               pending_transmission = trns;
+               Transmit();
        }
        if(t->isUser) {
                if(t->opType == TTT_UNKNOWN) t->opType = CIRCUIT;
@@ -708,7 +716,9 @@ void FGTower::ProcessRunwayVacatedReport(TowerPlaneRec* t) {
        }
        //cout << "trns = " << trns << '\n';
        if(_display) {
-               globals->get_ATC_display()->RegisterSingleMessage(trns);
+               //globals->get_ATC_display()->RegisterSingleMessage(trns);
+               pending_transmission = trns;
+               Transmit();
        }
        RemoveFromRwyList(t->plane.callsign);
        AddToVacatedList(t);
@@ -819,7 +829,9 @@ void FGTower::ClearHoldingPlane(TowerPlaneRec* t) {
                timeSinceLastDeparture = 0.0;
        }
        if(_display) {
-               globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
+               //globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
+               pending_transmission = trns;
+               Transmit();
        }
        //cout << "Done ClearHoldingPlane " << endl;
 }