]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/ATC.cxx
initlialize _playing for FGATC. Proper listerner orientation based on view offset...
[flightgear.git] / src / ATCDCL / ATC.cxx
index 92568edc56725be3de1cc605a47ed24685a6011a..b4a17ae9727d54d99d99db4938f691da25ccedc7 100644 (file)
@@ -36,6 +36,7 @@
 
 FGATC::FGATC() :
        _voiceOK(false),
+        _playing(false),
        _sgr(NULL),
        freqClear(true),
        receiving(false),
@@ -56,8 +57,7 @@ FGATC::FGATC() :
        _counter(0.0),
        _max_count(5.0)
 {
-       SGSoundMgr *smgr;
-       smgr = (SGSoundMgr *)globals->get_subsystem("soundmgr");
+       SGSoundMgr *smgr = globals->get_soundmgr();
        _sgr = smgr->find("atc", true);
 }
 
@@ -230,17 +230,15 @@ void FGATC::Render(string& msg, const float volume,
 #ifdef ENABLE_AUDIO_SUPPORT
        _voice = (_voiceOK && fgGetBool("/sim/sound/voice"));
        if(_voice) {
-               string buf = _vPtr->WriteMessage((char*)msg.c_str(), _voice);
-               if(_voice && (volume > 0.05)) {
+                size_t len;
+               void* buf = _vPtr->WriteMessage((char*)msg.c_str(), &len);
+               if(buf && (volume > 0.05)) {
                        NoRender(refname);
                        try {
 // >>> Beware: must pass a (new) object to the (add) method,
 // >>> because the (remove) method is going to do a (delete)
 // >>> whether that's what you want or not.
-                               SGSoundSample *simple = 
-                               new SGSoundSample((unsigned char*) buf.c_str(),  buf.length(), 8000);
-                               // TODO - at the moment the volume can't be changed 
-                               // after the transmission has started.
+                               SGSoundSample *simple = new SGSoundSample(&buf, len, 8000);
                                simple->set_volume(volume);
                                _sgr->add(simple, refname);
                                _sgr->play(refname, repeating);