]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/voice.cxx
Added two missing files from JSBSim.org that were missing in the last sync.
[flightgear.git] / src / Sound / voice.cxx
index 4bf45200350ae02c54da4b351122309d32809a88..04e9a3debaac352d34bd4eb73acc6aa48ddc6359 100644 (file)
@@ -52,6 +52,7 @@ FGVoiceMgr::~FGVoiceMgr()
                return;
        _thread->cancel();
        _thread->join();
+       delete _thread;
 #endif
 }
 
@@ -71,7 +72,8 @@ void FGVoiceMgr::init()
        }
 
 #if defined(ENABLE_THREADS)
-       _thread->start(1);
+       _thread->setProcessorAffinity(1);
+       _thread->start();
 #endif
 }
 
@@ -156,14 +158,11 @@ void FGVoiceMgr::FGVoice::pushMessage(string m)
 
 bool FGVoiceMgr::FGVoice::speak(void)
 {
-       if (_msg.empty()) {
-//             cerr << "<nothing to say>" << endl;
+       if (_msg.empty())
                return false;
-       }
 
        const string s = _msg.front();
        _msg.pop();
-//     cerr << "POP " << s;
        _sock->writestring(s.c_str());
        return !_msg.empty();
 }
@@ -242,7 +241,7 @@ void FGVoiceMgr::FGVoice::FGVoiceListener::valueChanged(SGPropertyNode *node)
                return;
 
        const string s = node->getStringValue();
-       //cerr << "\033[31;1mPUSH [" << s << "]\033[m" << endl;
+       //cerr << "\033[31;1mBEFORE [" << s << "]\033[m" << endl;
 
        string m;
        for (unsigned int i = 0; i < s.size(); i++) {
@@ -257,9 +256,16 @@ void FGVoiceMgr::FGVoice::FGVoiceListener::valueChanged(SGPropertyNode *node)
                        m += ' ';       // don't say "vertical bar" or "underscore"
                else if (c == '&')
                        m += " and ";
+               else if (c == '{') {
+                       while (i < s.size())
+                               if (s[++i] == '|')
+                                       break;
+               } else if (c == '}')
+                       ;
                else
                        m += c;
        }
+       //cerr << "\033[31;1mAFTER [" << m << "]\033[m" << endl;
        if (_voice->_festival)
                m = string("(SayText \"") + m + "\")";