If text contains "{display|voice}" groups, skip the delimiters and
discard the display part. The curly braces wouldn't be spoken anyway, and the | would be spoken as "vertical bar", which is completely useless (which is why it had been disabled in the past already).
This commit is contained in:
parent
2e9cf978b7
commit
60516c8a3f
1 changed files with 9 additions and 5 deletions
|
@ -156,14 +156,11 @@ void FGVoiceMgr::FGVoice::pushMessage(string m)
|
||||||
|
|
||||||
bool FGVoiceMgr::FGVoice::speak(void)
|
bool FGVoiceMgr::FGVoice::speak(void)
|
||||||
{
|
{
|
||||||
if (_msg.empty()) {
|
if (_msg.empty())
|
||||||
// cerr << "<nothing to say>" << endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
const string s = _msg.front();
|
const string s = _msg.front();
|
||||||
_msg.pop();
|
_msg.pop();
|
||||||
// cerr << "POP " << s;
|
|
||||||
_sock->writestring(s.c_str());
|
_sock->writestring(s.c_str());
|
||||||
return !_msg.empty();
|
return !_msg.empty();
|
||||||
}
|
}
|
||||||
|
@ -242,7 +239,7 @@ void FGVoiceMgr::FGVoice::FGVoiceListener::valueChanged(SGPropertyNode *node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const string s = node->getStringValue();
|
const string s = node->getStringValue();
|
||||||
//cerr << "\033[31;1mPUSH [" << s << "]\033[m" << endl;
|
//cerr << "\033[31;1mBEFORE [" << s << "]\033[m" << endl;
|
||||||
|
|
||||||
string m;
|
string m;
|
||||||
for (unsigned int i = 0; i < s.size(); i++) {
|
for (unsigned int i = 0; i < s.size(); i++) {
|
||||||
|
@ -257,9 +254,16 @@ void FGVoiceMgr::FGVoice::FGVoiceListener::valueChanged(SGPropertyNode *node)
|
||||||
m += ' '; // don't say "vertical bar" or "underscore"
|
m += ' '; // don't say "vertical bar" or "underscore"
|
||||||
else if (c == '&')
|
else if (c == '&')
|
||||||
m += " and ";
|
m += " and ";
|
||||||
|
else if (c == '{') {
|
||||||
|
while (i < s.size())
|
||||||
|
if (s[++i] == '|')
|
||||||
|
break;
|
||||||
|
} else if (c == '}')
|
||||||
|
;
|
||||||
else
|
else
|
||||||
m += c;
|
m += c;
|
||||||
}
|
}
|
||||||
|
//cerr << "\033[31;1mAFTER [" << m << "]\033[m" << endl;
|
||||||
if (_voice->_festival)
|
if (_voice->_festival)
|
||||||
m = string("(SayText \"") + m + "\")";
|
m = string("(SayText \"") + m + "\")";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue