summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/tts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/tts.cpp')
-rw-r--r--rbutil/rbutilqt/tts.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/rbutil/rbutilqt/tts.cpp b/rbutil/rbutilqt/tts.cpp
index 68f169e875..277022b9a1 100644
--- a/rbutil/rbutilqt/tts.cpp
+++ b/rbutil/rbutilqt/tts.cpp
@@ -142,7 +142,7 @@ void TTSExes::setCfg(RbSettings* sett)
142 break; 142 break;
143 } 143 }
144 } 144 }
145 settings->setTTSPath(m_name,exepath); 145 settings->setSubValue(m_name, RbSettings::TtsPath, exepath);
146 settings->sync(); 146 settings->sync();
147 } 147 }
148 148
@@ -150,8 +150,8 @@ void TTSExes::setCfg(RbSettings* sett)
150 150
151bool TTSExes::start(QString *errStr) 151bool TTSExes::start(QString *errStr)
152{ 152{
153 m_TTSexec = settings->ttsPath(m_name); 153 m_TTSexec = settings->subValue(m_name, RbSettings::TtsPath).toString();
154 m_TTSOpts = settings->ttsOptions(m_name); 154 m_TTSOpts = settings->subValue(m_name, RbSettings::TtsOptions).toString();
155 155
156 m_TTSTemplate = m_TemplateMap.value(m_name); 156 m_TTSTemplate = m_TemplateMap.value(m_name);
157 157
@@ -195,7 +195,7 @@ void TTSExes::showCfg()
195 195
196bool TTSExes::configOk() 196bool TTSExes::configOk()
197{ 197{
198 QString path = settings->ttsPath(m_name); 198 QString path = settings->subValue(m_name, RbSettings::TtsPath).toString();
199 199
200 if (QFileInfo(path).exists()) 200 if (QFileInfo(path).exists())
201 return true; 201 return true;
@@ -217,12 +217,12 @@ TTSSapi::TTSSapi() : TTSBase()
217bool TTSSapi::start(QString *errStr) 217bool TTSSapi::start(QString *errStr)
218{ 218{
219 219
220 m_TTSOpts = settings->ttsOptions("sapi"); 220 m_TTSOpts = settings->subValue("sapi", RbSettings::TtsOptions).toString();
221 m_TTSLanguage =settings->ttsLang("sapi"); 221 m_TTSLanguage =settings->subValue("sapi", RbSettings::TtsLanguage).toString();
222 m_TTSVoice=settings->ttsVoice("sapi"); 222 m_TTSVoice=settings->subValue("sapi", RbSettings::TtsVoice).toString();
223 m_TTSSpeed=QString("%1").arg(settings->ttsSpeed("sapi")); 223 m_TTSSpeed=QString("%1").arg(settings->subValue("sapi", RbSettings::TtsSpeed).toInt());
224 m_sapi4 = settings->ttsUseSapi4(); 224 m_sapi4 = settings->value(RbSettings::TtsUseSapi4).toBool();
225 225
226 QFile::remove(QDir::tempPath() +"/sapi_voice.vbs"); 226 QFile::remove(QDir::tempPath() +"/sapi_voice.vbs");
227 QFile::copy(":/builtin/sapi_voice.vbs",QDir::tempPath() + "/sapi_voice.vbs"); 227 QFile::copy(":/builtin/sapi_voice.vbs",QDir::tempPath() + "/sapi_voice.vbs");
228 m_TTSexec = QDir::tempPath() +"/sapi_voice.vbs"; 228 m_TTSexec = QDir::tempPath() +"/sapi_voice.vbs";
@@ -284,8 +284,8 @@ QStringList TTSSapi::getVoiceList(QString language)
284 QString execstring = "cscript //nologo \"%exe\" /language:%lang /listvoices"; 284 QString execstring = "cscript //nologo \"%exe\" /language:%lang /listvoices";
285 execstring.replace("%exe",m_TTSexec); 285 execstring.replace("%exe",m_TTSexec);
286 execstring.replace("%lang",language); 286 execstring.replace("%lang",language);
287 287
288 if(settings->ttsUseSapi4()) 288 if(settings->value(RbSettings::TtsUseSapi4).toBool())
289 execstring.append(" /sapi4 "); 289 execstring.append(" /sapi4 ");
290 290
291 qDebug() << "init" << execstring; 291 qDebug() << "init" << execstring;
@@ -363,7 +363,7 @@ void TTSSapi::showCfg()
363 363
364bool TTSSapi::configOk() 364bool TTSSapi::configOk()
365{ 365{
366 if(settings->ttsVoice("sapi").isEmpty()) 366 if(settings->subValue("sapi", RbSettings::TtsVoice).toString().isEmpty())
367 return false; 367 return false;
368 return true; 368 return true;
369} 369}
@@ -380,7 +380,7 @@ void TTSFestival::startServer()
380 if(!configOk()) 380 if(!configOk())
381 return; 381 return;
382 382
383 QStringList paths = settings->ttsPath("festival").split(":"); 383 QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":");
384 384
385 serverProcess.start(QString("%1 --server").arg(paths[0])); 385 serverProcess.start(QString("%1 --server").arg(paths[0]));
386 serverProcess.waitForStarted(); 386 serverProcess.waitForStarted();
@@ -414,8 +414,9 @@ bool TTSFestival::start(QString* errStr)
414{ 414{
415 (void) errStr; 415 (void) errStr;
416 ensureServerRunning(); 416 ensureServerRunning();
417 if (!settings->ttsVoice("festival").isEmpty()) 417 if (!settings->subValue("festival", RbSettings::TtsVoice).toString().isEmpty())
418 queryServer(QString("(voice.select '%1)").arg(settings->ttsVoice("festival"))); 418 queryServer(QString("(voice.select '%1)")
419 .arg(settings->subValue("festival", RbSettings::TtsVoice).toString()));
419 420
420 return true; 421 return true;
421} 422}
@@ -432,7 +433,7 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
432{ 433{
433 qDebug() << text << "->" << wavfile; 434 qDebug() << text << "->" << wavfile;
434 435
435 QStringList paths = settings->ttsPath("festival").split(":"); 436 QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":");
436 QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(paths[1]).arg(wavfile); 437 QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(paths[1]).arg(wavfile);
437 qDebug() << cmd; 438 qDebug() << cmd;
438 439
@@ -462,13 +463,15 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
462 463
463bool TTSFestival::configOk() 464bool TTSFestival::configOk()
464{ 465{
465 QStringList paths = settings->ttsPath("festival").split(":"); 466 QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":");
466 if(paths.size() != 2) 467 if(paths.size() != 2)
467 return false; 468 return false;
468 bool ret = QFileInfo(paths[0]).isExecutable() && 469 bool ret = QFileInfo(paths[0]).isExecutable() &&
469 QFileInfo(paths[1]).isExecutable(); 470 QFileInfo(paths[1]).isExecutable();
470 if(settings->ttsVoice("festival").size() > 0 && voices.size() > 0) 471 if(settings->subValue("festival", RbSettings::TtsVoice).toString().size() > 0
471 ret = ret && (voices.indexOf(settings->ttsVoice("festival")) != -1); 472 && voices.size() > 0)
473 ret = ret && (voices.indexOf(settings->subValue("festival",
474 RbSettings::TtsVoice).toString()) != -1);
472 return ret; 475 return ret;
473} 476}
474 477