X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FATCDCL%2FATC.cxx;h=2236619749b4096a3f8e66f639fed72d0dc29d9e;hb=33b7e3e32ec215931117e738b370107e0c47d036;hp=6aae329c946522c2aace1f31228d8629cfcf0bf4;hpb=45d2e693ee73d04ad958a1911f42cf7fa97bd814;p=flightgear.git diff --git a/src/ATCDCL/ATC.cxx b/src/ATCDCL/ATC.cxx index 6aae329c9..223661974 100644 --- a/src/ATCDCL/ATC.cxx +++ b/src/ATCDCL/ATC.cxx @@ -27,12 +27,13 @@ #include #include +#include #include #include
#include
#include -#include +#include FGATC::FGATC() : freq(0), @@ -40,7 +41,6 @@ FGATC::FGATC() : range(0), _voice(true), _playing(false), - _vPtr(NULL), _sgr(NULL), _type(INVALID), _display(false) @@ -80,6 +80,9 @@ FGATC::~FGATC() { // call this from their own Update(...). void FGATC::update(double dt) { + // TODO This doesn't really do anything specific to this instance. + // All FGATCs share the same "_sgr" sound group. So this really should + // only be done once for all FGATCs. #ifdef ENABLE_AUDIO_SUPPORT bool active = _atc_external->getBoolValue() || _internal->getBoolValue(); @@ -137,8 +140,8 @@ void FGATC::SetStation(flightgear::CommStation* sta) { // 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 FGATC::Render(string& msg, const float volume, - const string& refname, const bool repeating) { +void FGATC::Render(std::string& msg, const float volume, + const std::string& refname, const bool repeating) { if ((!_display) ||(volume < 0.05)) { NoRender(refname); @@ -163,10 +166,9 @@ void FGATC::Render(string& msg, const float volume, _currentMsg = msg; size_t len; void* buf = NULL; - if (!_vPtr) - _vPtr = GetVoicePointer(); - if (_vPtr) - buf = _vPtr->WriteMessage((char*)msg.c_str(), &len); + FGATCVoice* vPtr = GetVoicePointer(); + if (vPtr) + buf = vPtr->WriteMessage((char*)msg.c_str(), &len); NoRender(refname); if(buf) { try { @@ -188,6 +190,8 @@ void FGATC::Render(string& msg, const float volume, { NoRender(refname); } +#else + bool useVoice = false; #endif // ENABLE_AUDIO_SUPPORT if (!useVoice) @@ -204,7 +208,7 @@ void FGATC::Render(string& msg, const float volume, // Cease rendering a transmission. -void FGATC::NoRender(const string& refname) { +void FGATC::NoRender(const std::string& refname) { if(_playing) { if(_voice) { #ifdef ENABLE_AUDIO_SUPPORT