rbutil: hopefully fix sapi voice engine support. (sapi_voice.vbs wants now utf16)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18654 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Wenger 2008-09-27 00:05:54 +00:00
parent 1ab86bb370
commit 6a012210d0
2 changed files with 14 additions and 6 deletions

View file

@ -246,6 +246,10 @@ bool TTSSapi::start(QString *errStr)
if(*errStr != "")
return false;
}
voicestream = new QTextStream(voicescript);
voicestream->setCodec("UTF16-LE");
return true;
}
@ -272,9 +276,10 @@ QStringList TTSSapi::getVoiceList(QString language)
qDebug() << "init" << execstring;
voicescript = new QProcess(NULL);
voicescript->start(execstring);
qDebug() << "wait for started";
if(!voicescript->waitForStarted())
return result;
voicescript->closeWriteChannel();
voicescript->waitForReadyRead();
QString dataRaw = voicescript->readAllStandardError().data();
@ -303,17 +308,20 @@ bool TTSSapi::voice(QString text,QString wavfile)
{
QString query = "SPEAK\t"+wavfile+"\t"+text+"\r\n";
qDebug() << "voicing" << query;
voicescript->write(query.toLocal8Bit());
voicescript->write("SYNC\tbla\r\n");
*voicestream << query;
*voicestream << "SYNC\tbla\r\n";
voicestream->flush();
voicescript->waitForReadyRead();
return true;
}
bool TTSSapi::stop()
{
QString query = "QUIT\r\n";
voicescript->write(query.toLocal8Bit());
*voicestream << "QUIT\r\n";
voicestream->flush();
voicescript->waitForFinished();
delete voicestream;
delete voicescript;
QFile::setPermissions(QDir::tempPath() +"/sapi_voice.vbs",QFile::ReadOwner |QFile::WriteOwner|QFile::ExeOwner
|QFile::ReadUser| QFile::WriteUser| QFile::ExeUser

View file

@ -81,7 +81,7 @@ class TTSSapi : public TTSBase
QStringList getVoiceList(QString language);
private:
QProcess* voicescript;
QTextStream* voicestream;
QString defaultLanguage;
QString m_TTSexec;