return;
_thread->cancel();
_thread->join();
+ delete _thread;
#endif
}
}
#if defined(ENABLE_THREADS)
- _thread->start(1);
+ _thread->setProcessorAffinity(1);
+ _thread->start();
#endif
}
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();
}
return;
const string s = node->getStringValue();
-// cerr << "PUSH " << s << endl;
+ //cerr << "\033[31;1mBEFORE [" << s << "]\033[m" << endl;
string m;
for (unsigned int i = 0; i < s.size(); i++) {
char c = s[i];
- if (!isprint(c))
+ if (c == '\n' || c == '\r' || c == '\t')
+ m += ' ';
+ else if (!isprint(c))
continue;
- else if (c == '"' || c == '\\')
- m += '\\' + c;
+ else if (c == '\\' || c == '"')
+ m += '\\', m += c;
else if (c == '|' || c == '_')
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 + "\")";