]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/AIPlane.cxx
Merge branch 'torsten/metar'
[flightgear.git] / src / ATCDCL / AIPlane.cxx
index f672676eb8ad894e7ee3dd1665b3a1487b66b2b2..8fd67d13aeb190b837706c8996e27c339f068b90 100644 (file)
@@ -29,8 +29,6 @@ using std::string;
 
 #include "AIPlane.hxx"
 
-SGSampleGroup *FGAIPlane::_sgr = 0;
-
 FGAIPlane::FGAIPlane() {
        leg = LEG_UNKNOWN;
        tuned_station = NULL;
@@ -51,9 +49,9 @@ FGAIPlane::FGAIPlane() {
        _rollSuspended = false;
 
        if ( !_sgr ) {
-               SGSoundMgr *smgr;
-               smgr = (SGSoundMgr *)globals->get_subsystem("soundmgr");
+               SGSoundMgr *smgr = globals->get_soundmgr();
                _sgr = smgr->find("atc", true);
+                _sgr->tie_to_listener();
        }
 }
 
@@ -197,12 +195,10 @@ void FGAIPlane::Render(const string& refname, const float volume, bool repeating
 #ifdef ENABLE_AUDIO_SUPPORT
        voice = (voiceOK && fgGetBool("/sim/sound/voice"));
        if(voice) {
-           string buf = vPtr->WriteMessage((char*)pending_transmission.c_str(), voice);
+            size_t len;
+           void* buf = vPtr->WriteMessage(pending_transmission, &len);
            if(voice && (volume > 0.05)) {
-               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);