summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/ttssapi.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-09-26 21:28:05 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-09-26 21:28:05 +0000
commitfe3eadffba810be2666435d68b929027130d47ed (patch)
tree4c47fef3017b76c28f1697e304062cdadd6dd1e2 /rbutil/rbutilqt/base/ttssapi.cpp
parentc7c657ca9264b1bc7dc313a92e285128fc9ffea3 (diff)
downloadrockbox-fe3eadffba810be2666435d68b929027130d47ed.tar.gz
rockbox-fe3eadffba810be2666435d68b929027130d47ed.zip
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
Diffstat (limited to 'rbutil/rbutilqt/base/ttssapi.cpp')
-rw-r--r--rbutil/rbutilqt/base/ttssapi.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/base/ttssapi.cpp b/rbutil/rbutilqt/base/ttssapi.cpp
index cd9ced8083..cb7d8a5057 100644
--- a/rbutil/rbutilqt/base/ttssapi.cpp
+++ b/rbutil/rbutilqt/base/ttssapi.cpp
@@ -26,8 +26,9 @@ TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
26{ 26{
27 m_TTSTemplate = "cscript //nologo \"%exe\" /language:%lang /voice:\"%voice\"" 27 m_TTSTemplate = "cscript //nologo \"%exe\" /language:%lang /voice:\"%voice\""
28 " /speed:%speed \"%options\""; 28 " /speed:%speed \"%options\"";
29 defaultLanguage ="english"; 29 defaultLanguage = "english";
30 m_sapi4 =false; 30 m_sapi4 = false;
31 m_started = false;
31} 32}
32 33
33TTSBase::Capabilities TTSSapi::capabilities() 34TTSBase::Capabilities TTSSapi::capabilities()
@@ -138,9 +139,29 @@ bool TTSSapi::start(QString *errStr)
138 voicestream = new QTextStream(voicescript); 139 voicestream = new QTextStream(voicescript);
139 voicestream->setCodec("UTF16-LE"); 140 voicestream->setCodec("UTF16-LE");
140 141
142 m_started = true;
141 return true; 143 return true;
142} 144}
143 145
146QString TTSSapi::voiceVendor(void)
147{
148 bool keeprunning = m_started;
149 QString vendor;
150 if(!m_started) {
151 QString error;
152 start(&error);
153 }
154 *voicestream << "QUERY\tVENDOR\r\n";
155 voicestream->flush();
156 while((vendor = voicestream->readLine()).isEmpty())
157 QCoreApplication::processEvents();
158
159 qDebug() << "[TTSSAPI] TTS vendor:" << vendor;
160 if(!keeprunning) {
161 stop();
162 }
163 return vendor;
164}
144 165
145QStringList TTSSapi::getVoiceList(QString language) 166QStringList TTSSapi::getVoiceList(QString language)
146{ 167{
@@ -226,6 +247,7 @@ bool TTSSapi::stop()
226 | QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup 247 | QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup
227 | QFile::ReadOther | QFile::WriteOther | QFile::ExeOther ); 248 | QFile::ReadOther | QFile::WriteOther | QFile::ExeOther );
228 QFile::remove(QDir::tempPath() +"/sapi_voice.vbs"); 249 QFile::remove(QDir::tempPath() +"/sapi_voice.vbs");
250 m_started = false;
229 return true; 251 return true;
230} 252}
231 253