_transmitting = false;
_counter = 0.0;
_max_count = 5.0;
+
+ _voiceOK = false;
}
FGATC::~FGATC() {
//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';
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);
// 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
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);
} else {
globals->get_ATC_display()->CancelRepeatingMessage();
}
- playing = false;
+ _playing = false;
}
}
// 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);
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
//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;
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;
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;
}
}
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';
}
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.
}
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)) {
}
}
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;
}
//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);
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;
}