_trackSet = false;
_tgtRoll = 0.0;
_rollSuspended = false;
- _sgr = 0;
+
+ if ( !_sgr ) {
+ SGSoundMgr *smgr = globals->get_soundmgr();
+ _sgr = smgr->find("atc", true);
+ _sgr->tie_to_listener();
+ }
}
FGAIPlane::~FGAIPlane() {
}
void FGAIPlane::Update(double dt) {
- if (!_sgr) {
- SGSoundMgr *smgr = (SGSoundMgr *)globals->get_subsystem("soundmgr");
- if (smgr) _sgr = smgr->find("atc", true);
- }
-
if(_pending) {
if(tuned_station) {
if(tuned_station->GetFreqClear()) {
#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);