]> git.mxchange.org Git - flightgear.git/commitdiff
activate atc settings in the sound mixer dialog
authorehofman <ehofman>
Thu, 10 Dec 2009 09:56:42 +0000 (09:56 +0000)
committerTim Moore <timoore@redhat.com>
Fri, 11 Dec 2009 23:12:19 +0000 (00:12 +0100)
src/ATCDCL/ATC.cxx
src/ATCDCL/ATC.hxx

index 6bb6a228270ff8729fc1deaaf85ce26978e5c94e..41c56e64844998beb1db3d754b6fdedbc169d315 100644 (file)
@@ -36,7 +36,7 @@
 
 FGATC::FGATC() :
        _voiceOK(false),
-        _playing(false),
+       _playing(false),
        _sgr(NULL),
        freqClear(true),
        receiving(false),
@@ -59,6 +59,11 @@ FGATC::FGATC() :
 {
        SGSoundMgr *smgr = globals->get_soundmgr();
        _sgr = smgr->find("atc", true);
+
+       _volume = fgGetNode("/sim/sound/atc/volume", true);
+       _enabled = fgGetNode("/sim/sound/atc/enabled", true);
+       _atc_external = fgGetNode("/sim/sound/atc/external-view", true);
+       _internal = fgGetNode("/sim/current-view/internal", true);
 }
 
 FGATC::~FGATC() {
@@ -107,6 +112,18 @@ void FGATC::Update(double dt) {
                }
        }
 
+#ifdef ENABLE_AUDIO_SUPPORT
+       bool active = _atc_external->getBoolValue() ||
+                     _internal->getBoolValue();
+
+       if ( active && _enabled->getBoolValue() ) {
+               _sgr->set_volume( _volume->getFloatValue() );
+               _sgr->resume(); // no-op if already in resumed state
+       } else {
+               _sgr->suspend();
+       }
+#endif
+
        if(_transmit) {
                _counter = 0.0;
                _max_count = 5.0;               // FIXME - hardwired length of message - need to calculate it!
@@ -232,7 +249,7 @@ void FGATC::Render(string& msg, const float volume,
 #ifdef ENABLE_AUDIO_SUPPORT
        _voice = (_voiceOK && fgGetBool("/sim/sound/voice"));
        if(_voice) {
-                size_t len;
+               size_t len;
                void* buf = _vPtr->WriteMessage((char*)msg.c_str(), &len);
                if(buf) {
                        NoRender(refname);
@@ -325,7 +342,7 @@ std::istream& operator >> ( std::istream& fin, ATCData& a )
        }
        
        double lat, lon, elev;
-  
+
        fin >> lat >> lon >> elev >> f >> a.range >> a.ident;
        a.geod = SGGeod::fromDegM(lon, lat, elev);
        a.name = "";
index dd3fc8be2433bc71c95d8c16a156aa113d45f8fd..e2751460e1cb3e01999850e9a4f67aadcb64ee2d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <simgear/constants.h>
 #include <simgear/compiler.h>
+#include <simgear/props/props.hxx>
 #include <simgear/misc/sgstream.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/debug/logstream.hxx>
@@ -247,6 +248,11 @@ private:
        bool _transmitting;     // we are transmitting
        double _counter;
        double _max_count;
+
+       SGPropertyNode_ptr _volume;
+       SGPropertyNode_ptr _enabled;
+       SGPropertyNode_ptr _atc_external;
+       SGPropertyNode_ptr _internal;
 };
 
 std::istream& operator>> ( std::istream& fin, ATCData& a );