X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FSound%2Fvoice.cxx;h=c1dec0b0ed688ba34055b67d97a48538d8b5b396;hb=e88e821567cc6bb6214fa0b9ee13b52e74b24ffa;hp=d3af414717785c67fa53713caf4d3d2e2b589cb3;hpb=60516c8a3fca21386ec1c7d16cd0cc18e460cce2;p=flightgear.git diff --git a/src/Sound/voice.cxx b/src/Sound/voice.cxx index d3af41471..c1dec0b0e 100644 --- a/src/Sound/voice.cxx +++ b/src/Sound/voice.cxx @@ -20,6 +20,10 @@ // // $Id$ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include
#include #include @@ -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", "") + SG_LOG(SG_SOUND, SG_INFO, "VOICE: adding `" << node->getStringValue("desc", "") << "' 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());