Rockbox Utility TTS: implement reading TTS vendor.

Support retrieving the vendor name of the TTS. This will be used by TTS string
corrections. Currently no other TTS but SAPI supports this, and only correction
strings for SAPI voices depend on the vendor information.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30609 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2011-09-26 21:28:05 +00:00
parent c7c657ca92
commit fe3eadffba
6 changed files with 33 additions and 5 deletions

View file

@ -26,8 +26,9 @@ TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
{
m_TTSTemplate = "cscript //nologo \"%exe\" /language:%lang /voice:\"%voice\""
" /speed:%speed \"%options\"";
defaultLanguage ="english";
m_sapi4 =false;
defaultLanguage = "english";
m_sapi4 = false;
m_started = false;
}
TTSBase::Capabilities TTSSapi::capabilities()
@ -138,9 +139,29 @@ bool TTSSapi::start(QString *errStr)
voicestream = new QTextStream(voicescript);
voicestream->setCodec("UTF16-LE");
m_started = true;
return true;
}
QString TTSSapi::voiceVendor(void)
{
bool keeprunning = m_started;
QString vendor;
if(!m_started) {
QString error;
start(&error);
}
*voicestream << "QUERY\tVENDOR\r\n";
voicestream->flush();
while((vendor = voicestream->readLine()).isEmpty())
QCoreApplication::processEvents();
qDebug() << "[TTSSAPI] TTS vendor:" << vendor;
if(!keeprunning) {
stop();
}
return vendor;
}
QStringList TTSSapi::getVoiceList(QString language)
{
@ -226,6 +247,7 @@ bool TTSSapi::stop()
| QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup
| QFile::ReadOther | QFile::WriteOther | QFile::ExeOther );
QFile::remove(QDir::tempPath() +"/sapi_voice.vbs");
m_started = false;
return true;
}