- int len;
- unsigned char* buf = vPtr->WriteMessage((char*)pending_transmission.c_str(), len, voice);
- if(voice) {
- SGSoundSample* simple = new SGSoundSample(buf, len, 8000);
- // TODO - at the moment the volume is always set off comm1
- // and can't be changed after the transmission has started.
- simple->set_volume(5.0 * fgGetDouble("/instrumentation/comm[0]/volume"));
- globals->get_soundmgr()->add(simple, refname);
- if(repeating) {
- globals->get_soundmgr()->play_looped(refname);
- } else {
- globals->get_soundmgr()->play_once(refname);
- }
- }
- delete[] buf;
+ size_t len;
+ void* buf = vPtr->WriteMessage(pending_transmission, &len);
+ if(voice && (volume > 0.05)) {
+ SGSoundSample* simple = new SGSoundSample(&buf, len, 8000 );
+ simple->set_volume(volume);
+ _sgr->add(simple, refname);
+ _sgr->play(refname, repeating);
+ }