1
0
Fork 0

Syd Adams:

Patch to enable atc chatter (and any other arbitrary "message" audio file)
to be played at any specified volume.  (Previously these messages were always
played at a hardcoded volume of 1.0)
This commit is contained in:
curt 2007-04-20 18:32:42 +00:00
parent f9e288fce2
commit c8986567ae
3 changed files with 5 additions and 4 deletions

View file

@ -1157,8 +1157,9 @@ do_play_audio_message (const SGPropertyNode * arg)
FGFX *fx = (FGFX *)globals->get_subsystem("fx"); FGFX *fx = (FGFX *)globals->get_subsystem("fx");
string path = arg->getStringValue("path"); string path = arg->getStringValue("path");
string file = arg->getStringValue("file"); string file = arg->getStringValue("file");
double volume = arg->getDoubleValue("volume");
// cout << "playing " << path << " / " << file << endl; // cout << "playing " << path << " / " << file << endl;
fx->play_message( path, file ); fx->play_message( path, file, volume );
return true; return true;
} }

View file

@ -187,17 +187,17 @@ FGFX::update (double dt)
void void
FGFX::play_message( SGSoundSample *_sample ) FGFX::play_message( SGSoundSample *_sample )
{ {
_sample->set_volume( 1.0 );
_samplequeue.push( _sample ); _samplequeue.push( _sample );
} }
void void
FGFX::play_message( const string path, const string fname ) FGFX::play_message( const string path, const string fname, double volume )
{ {
if (globals->get_soundmgr()->is_working() == false) { if (globals->get_soundmgr()->is_working() == false) {
return; return;
} }
SGSoundSample *sample; SGSoundSample *sample;
sample = new SGSoundSample( path.c_str(), fname.c_str() ); sample = new SGSoundSample( path.c_str(), fname.c_str() );
sample->set_volume( volume );
play_message( sample ); play_message( sample );
} }

View file

@ -72,7 +72,7 @@ public:
* in order. * in order.
*/ */
void play_message( SGSoundSample *_sample ); void play_message( SGSoundSample *_sample );
void play_message( const string path, const string fname ); void play_message( const string path, const string fname, double volume );
private: private: