]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/voice.cxx
Flight-history men usage cap.
[flightgear.git] / src / Sound / voice.cxx
index d3af414717785c67fa53713caf4d3d2e2b589cb3..c1dec0b0ed688ba34055b67d97a48538d8b5b396 100644 (file)
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <Main/globals.hxx>
 #include <sstream>
 #include <simgear/compiler.h>
@@ -28,6 +32,7 @@
 
 #define VOICE "/sim/sound/voices"
 
+using std::string;
 
 /// MANAGER ///
 
@@ -35,7 +40,7 @@ FGVoiceMgr::FGVoiceMgr() :
        _host(fgGetString(VOICE "/host", "localhost")),
        _port(fgGetString(VOICE "/port", "1314")),
        _enabled(fgGetBool(VOICE "/enabled", false)),
-       _pausedNode(fgGetNode("/sim/sound/pause", true))
+       _pausedNode(fgGetNode("/sim/sound/working", true))
 {
 #if defined(ENABLE_THREADS)
        if (!_enabled)
@@ -52,6 +57,7 @@ FGVoiceMgr::~FGVoiceMgr()
                return;
        _thread->cancel();
        _thread->join();
+       delete _thread;
 #endif
 }
 
@@ -66,12 +72,13 @@ void FGVoiceMgr::init()
        try {
                for (unsigned int i = 0; i < voices.size(); i++)
                        _voices.push_back(new FGVoice(this, voices[i]));
-       } catch (const string& s) {
-               SG_LOG(SG_IO, SG_ALERT, "VOICE: " << s);
+       } catch (const std::string& s) {
+               SG_LOG(SG_SOUND, SG_ALERT, "VOICE: " << s);
        }
 
 #if defined(ENABLE_THREADS)
-       _thread->start(1);
+       _thread->setProcessorAffinity(1);
+       _thread->start();
 #endif
 }
 
@@ -81,7 +88,7 @@ void FGVoiceMgr::update(double)
        if (!_enabled)
                return;
 
-       _paused = _pausedNode->getBoolValue();
+       _paused = !_pausedNode->getBoolValue();
        for (unsigned int i = 0; i < _voices.size(); i++) {
                _voices[i]->update();
 #if !defined(ENABLE_THREADS)
@@ -103,7 +110,7 @@ FGVoiceMgr::FGVoice::FGVoice(FGVoiceMgr *mgr, const SGPropertyNode_ptr node) :
        _festival(node->getBoolValue("festival", true)),
        _mgr(mgr)
 {
-       SG_LOG(SG_IO, SG_INFO, "VOICE: adding `" << node->getStringValue("desc", "<unnamed>")
+       SG_LOG(SG_SOUND, SG_INFO, "VOICE: adding `" << node->getStringValue("desc", "<unnamed>")
                        << "' voice");
        const string &host = _mgr->_host;
        const string &port = _mgr->_port;
@@ -122,7 +129,7 @@ FGVoiceMgr::FGVoice::FGVoice(FGVoiceMgr *mgr, const SGPropertyNode_ptr node) :
                                        + "'. Either it's not\n       Festival listening,"
                                        " or Festival couldn't open a sound device.";
 
-               SG_LOG(SG_IO, SG_INFO, "VOICE: connection to Festival server on `"
+               SG_LOG(SG_SOUND, SG_INFO, "VOICE: connection to Festival server on `"
                                << host << ':' << port << "' established");
 
                setVolume(_volume = _volumeNode->getDoubleValue());