From c8986567ae420656ae2c1ef934e3b1b59b6ebeeb Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 20 Apr 2007 18:32:42 +0000 Subject: [PATCH] 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) --- src/Main/fg_commands.cxx | 3 ++- src/Sound/fg_fx.cxx | 4 ++-- src/Sound/fg_fx.hxx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index e07295dde..21b86efbc 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1157,8 +1157,9 @@ do_play_audio_message (const SGPropertyNode * arg) FGFX *fx = (FGFX *)globals->get_subsystem("fx"); string path = arg->getStringValue("path"); string file = arg->getStringValue("file"); + double volume = arg->getDoubleValue("volume"); // cout << "playing " << path << " / " << file << endl; - fx->play_message( path, file ); + fx->play_message( path, file, volume ); return true; } diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index 37df00392..de5f4e152 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -187,17 +187,17 @@ FGFX::update (double dt) void FGFX::play_message( SGSoundSample *_sample ) { - _sample->set_volume( 1.0 ); _samplequeue.push( _sample ); } 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) { return; } SGSoundSample *sample; sample = new SGSoundSample( path.c_str(), fname.c_str() ); + sample->set_volume( volume ); play_message( sample ); } diff --git a/src/Sound/fg_fx.hxx b/src/Sound/fg_fx.hxx index 3bfa58c35..0fd4a2ff2 100644 --- a/src/Sound/fg_fx.hxx +++ b/src/Sound/fg_fx.hxx @@ -72,7 +72,7 @@ public: * in order. */ 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: