emit to different message properties:
/sim/messages/{atc,pilot,ai-plane,ground,approach} These can the be used for differenct screen.log colors and for different voices. (Aircraft & tutoruals may want to write to /sim/messages/copilot)
This commit is contained in:
parent
3b3df3cb01
commit
3cdea0705d
7 changed files with 23 additions and 10 deletions
|
@ -182,6 +182,7 @@ void FGAIPlane::ProcessCallback(int code) {
|
||||||
// The refname is a string to identify this sample to the sound manager
|
// 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.
|
// The repeating flag indicates whether the message should be repeated continuously or played once.
|
||||||
void FGAIPlane::Render(const string& refname, bool repeating) {
|
void FGAIPlane::Render(const string& refname, bool repeating) {
|
||||||
|
fgSetString("/sim/messages/ai-plane", pending_transmission.c_str());
|
||||||
#ifdef ENABLE_AUDIO_SUPPORT
|
#ifdef ENABLE_AUDIO_SUPPORT
|
||||||
voice = (voiceOK && fgGetBool("/sim/sound/voice"));
|
voice = (voiceOK && fgGetBool("/sim/sound/voice"));
|
||||||
if(voice) {
|
if(voice) {
|
||||||
|
|
|
@ -225,6 +225,7 @@ void FGATC::SetData(ATCData* d) {
|
||||||
// The refname is a string to identify this sample to the sound manager
|
// 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.
|
// The repeating flag indicates whether the message should be repeated continuously or played once.
|
||||||
void FGATC::Render(string& msg, const string& refname, bool repeating) {
|
void FGATC::Render(string& msg, const string& refname, bool repeating) {
|
||||||
|
fgSetString("/sim/messages/atc", msg.c_str());
|
||||||
#ifdef ENABLE_AUDIO_SUPPORT
|
#ifdef ENABLE_AUDIO_SUPPORT
|
||||||
_voice = (_voiceOK && fgGetBool("/sim/sound/voice"));
|
_voice = (_voiceOK && fgGetBool("/sim/sound/voice"));
|
||||||
if(_voice) {
|
if(_voice) {
|
||||||
|
|
|
@ -268,8 +268,10 @@ void FGATCDialog::PopupCallback(int num) {
|
||||||
//cout << "Doing callback...\n";
|
//cout << "Doing callback...\n";
|
||||||
ATCMenuEntry a = atcmlist[num];
|
ATCMenuEntry a = atcmlist[num];
|
||||||
atcptr->SetFreqInUse();
|
atcptr->SetFreqInUse();
|
||||||
|
string pilot = atcptr->GenText(a.transmission, a.callback_code);
|
||||||
|
fgSetString("/sim/messages/pilot", pilot.c_str());
|
||||||
// This is the user's speech getting displayed.
|
// This is the user's speech getting displayed.
|
||||||
globals->get_ATC_display()->RegisterSingleMessage(atcptr->GenText(a.transmission, a.callback_code));
|
globals->get_ATC_display()->RegisterSingleMessage(pilot);
|
||||||
_callbackPending = true;
|
_callbackPending = true;
|
||||||
_callbackTimer = 0.0;
|
_callbackTimer = 0.0;
|
||||||
_callbackWait = 5.0;
|
_callbackWait = 5.0;
|
||||||
|
|
|
@ -215,14 +215,12 @@ void FGATCDisplay::RegisterSingleMessage(const string& msg, double delay) {
|
||||||
m.dsp_offset = 0.0;
|
m.dsp_offset = 0.0;
|
||||||
|
|
||||||
msgList.push_back(m);
|
msgList.push_back(m);
|
||||||
fgSetString("/sim/messages/atc", msg.c_str());
|
|
||||||
//cout << "Single message registered\n";
|
//cout << "Single message registered\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGATCDisplay::RegisterRepeatingMessage(const string& msg) {
|
void FGATCDisplay::RegisterRepeatingMessage(const string& msg) {
|
||||||
rep_msg = true;
|
rep_msg = true;
|
||||||
rep_msg_str = msg;
|
rep_msg_str = msg;
|
||||||
fgSetString("/sim/messages/atc", msg.c_str());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ void FGApproach::Update(double dt) {
|
||||||
tpars.alt = planes[i].aalt;
|
tpars.alt = planes[i].aalt;
|
||||||
message = current_transmissionlist->gen_text(station, code, tpars, true );
|
message = current_transmissionlist->gen_text(station, code, tpars, true );
|
||||||
//cout << message << '\n';
|
//cout << message << '\n';
|
||||||
globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
|
set_message(message);
|
||||||
planes[i].lmc = code;
|
planes[i].lmc = code;
|
||||||
planes[i].tlm = etime_node->getDoubleValue();
|
planes[i].tlm = etime_node->getDoubleValue();
|
||||||
planes[i].on_crs = true;
|
planes[i].on_crs = true;
|
||||||
|
@ -237,8 +237,7 @@ void FGApproach::Update(double dt) {
|
||||||
message = current_transmissionlist->gen_text(station, code, tpars, true );
|
message = current_transmissionlist->gen_text(station, code, tpars, true );
|
||||||
//cout << "Approach transmitting...\n";
|
//cout << "Approach transmitting...\n";
|
||||||
//cout << message << endl;
|
//cout << message << endl;
|
||||||
globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
|
set_message(message);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
code.c1 = 1;
|
code.c1 = 1;
|
||||||
|
@ -248,7 +247,7 @@ void FGApproach::Update(double dt) {
|
||||||
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
||||||
//cout << "Approach transmitting 2 ...\n";
|
//cout << "Approach transmitting 2 ...\n";
|
||||||
//cout << message << endl;
|
//cout << message << endl;
|
||||||
globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
|
set_message(message);
|
||||||
}
|
}
|
||||||
planes[i].lmc = code;
|
planes[i].lmc = code;
|
||||||
planes[i].tlm = etime_node->getDoubleValue();
|
planes[i].tlm = etime_node->getDoubleValue();
|
||||||
|
@ -295,7 +294,7 @@ void FGApproach::Update(double dt) {
|
||||||
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
||||||
//cout << "Approach transmitting 3 ...\n";
|
//cout << "Approach transmitting 3 ...\n";
|
||||||
//cout << message << '\n';
|
//cout << message << '\n';
|
||||||
globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
|
set_message(message);
|
||||||
planes[i].lmc = code;
|
planes[i].lmc = code;
|
||||||
planes[i].tlm = etime_node->getDoubleValue();
|
planes[i].tlm = etime_node->getDoubleValue();
|
||||||
}
|
}
|
||||||
|
@ -325,7 +324,7 @@ void FGApproach::Update(double dt) {
|
||||||
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
||||||
//cout << "Approach transmitting 4 ...\n";
|
//cout << "Approach transmitting 4 ...\n";
|
||||||
//cout << message << '\n';
|
//cout << message << '\n';
|
||||||
globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
|
set_message(message);
|
||||||
planes[i].lmc = code;
|
planes[i].lmc = code;
|
||||||
planes[i].tlm = etime_node->getDoubleValue();
|
planes[i].tlm = etime_node->getDoubleValue();
|
||||||
|
|
||||||
|
@ -352,7 +351,7 @@ void FGApproach::Update(double dt) {
|
||||||
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
message = current_transmissionlist->gen_text(station, code, tpars, true);
|
||||||
//cout << "Approach transmitting 5 ...\n";
|
//cout << "Approach transmitting 5 ...\n";
|
||||||
//cout << message << '\n';
|
//cout << message << '\n';
|
||||||
globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
|
set_message(message);
|
||||||
planes[i].lmc = code;
|
planes[i].lmc = code;
|
||||||
planes[i].tlm = etime_node->getDoubleValue();
|
planes[i].tlm = etime_node->getDoubleValue();
|
||||||
|
|
||||||
|
@ -752,3 +751,11 @@ int FGApproach::RemovePlane() {
|
||||||
|
|
||||||
return num_planes;
|
return num_planes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FGApproach::set_message(const string &msg)
|
||||||
|
{
|
||||||
|
fgSetString("/sim/messages/approach", msg.c_str());
|
||||||
|
globals->get_ATC_display()->RegisterSingleMessage( msg, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,8 @@ private:
|
||||||
|
|
||||||
double angle_diff_deg( const double &a1, const double &a2);
|
double angle_diff_deg( const double &a1, const double &a2);
|
||||||
|
|
||||||
|
void set_message(const string &s);
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// get point2 given starting point1 and course and distance
|
// get point2 given starting point1 and course and distance
|
||||||
// input: point1 = heading in degrees, distance
|
// input: point1 = heading in degrees, distance
|
||||||
|
|
|
@ -320,6 +320,7 @@ void FGGround::Update(double dt) {
|
||||||
// eg " taxi holding point G2 runway "
|
// eg " taxi holding point G2 runway "
|
||||||
trns += ConvertRwyNumToSpokenString(activeRwy);
|
trns += ConvertRwyNumToSpokenString(activeRwy);
|
||||||
if(_display) {
|
if(_display) {
|
||||||
|
fgSetString("/sim/messages/ground", trns.c_str());
|
||||||
globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
|
globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
|
||||||
}
|
}
|
||||||
g->planePtr->RegisterTransmission(1); // cleared to taxi
|
g->planePtr->RegisterTransmission(1); // cleared to taxi
|
||||||
|
@ -338,6 +339,7 @@ void FGGround::Update(double dt) {
|
||||||
sprintf(buf, "%.2f", f);
|
sprintf(buf, "%.2f", f);
|
||||||
trns += buf;
|
trns += buf;
|
||||||
if(_display) {
|
if(_display) {
|
||||||
|
fgSetString("/sim/messages/ground", trns.c_str());
|
||||||
globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
|
globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
|
||||||
}
|
}
|
||||||
g->planePtr->RegisterTransmission(2); // contact tower
|
g->planePtr->RegisterTransmission(2); // contact tower
|
||||||
|
|
Loading…
Add table
Reference in a new issue