X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FATCDCL%2FATISmgr.cxx;h=abb7490a4750a72229d1ffb167f3b8687e1770e6;hb=33b7e3e32ec215931117e738b370107e0c47d036;hp=1c5dc8ca7936dc2a23b40219ce2f8009dacc2341;hpb=a2bd520a3baa6b5d1ad63aa3e578d8808e5cbcdc;p=flightgear.git diff --git a/src/ATCDCL/ATISmgr.cxx b/src/ATCDCL/ATISmgr.cxx index 1c5dc8ca7..abb7490a4 100644 --- a/src/ATCDCL/ATISmgr.cxx +++ b/src/ATCDCL/ATISmgr.cxx @@ -47,10 +47,8 @@ FGATISMgr::~FGATISMgr() { globals->set_ATIS_mgr(NULL); - for (unsigned int unit = 0;unit < _maxCommRadios; ++unit) - { + for (unsigned int unit = 0;unit < radios.size(); ++unit) { delete radios[unit]; - radios[unit] = NULL; } #ifdef ENABLE_AUDIO_SUPPORT @@ -69,6 +67,19 @@ void FGATISMgr::init() } } +void FGATISMgr::reinit() +{ +#ifdef ENABLE_AUDIO_SUPPORT + if ((voiceName != "")&& + (voiceName != fgGetString("/sim/atis/voice", "default"))) + { + voiceName = fgGetString("/sim/atis/voice", "default"); + delete voice; + voice = NULL; + useVoice = true; + } +#endif +} void FGATISMgr::update(double dt) { @@ -108,10 +119,11 @@ FGATCVoice* FGATISMgr::GetVoicePointer(const atc_type& type) */ if (!voice && fgGetBool("/sim/sound/working")) { voice = new FGATCVoice; + voiceName = fgGetString("/sim/atis/voice", "default"); try { - useVoice = voice->LoadVoice("default"); + useVoice = voice->LoadVoice(voiceName); } catch ( sg_io_exception & e) { - SG_LOG(SG_ATC, SG_ALERT, "Unable to load default voice : " + SG_LOG(SG_ATC, SG_ALERT, "Unable to load voice '" << voiceName << "': " << e.getFormattedMessage().c_str()); useVoice = false; delete voice;