mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-11 06:05:21 -05:00
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:
parent
1ab86bb370
commit
6a012210d0
2 changed files with 14 additions and 6 deletions
|
|
@ -246,6 +246,10 @@ bool TTSSapi::start(QString *errStr)
|
||||||
if(*errStr != "")
|
if(*errStr != "")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
voicestream = new QTextStream(voicescript);
|
||||||
|
voicestream->setCodec("UTF16-LE");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -272,9 +276,10 @@ QStringList TTSSapi::getVoiceList(QString language)
|
||||||
qDebug() << "init" << execstring;
|
qDebug() << "init" << execstring;
|
||||||
voicescript = new QProcess(NULL);
|
voicescript = new QProcess(NULL);
|
||||||
voicescript->start(execstring);
|
voicescript->start(execstring);
|
||||||
|
qDebug() << "wait for started";
|
||||||
if(!voicescript->waitForStarted())
|
if(!voicescript->waitForStarted())
|
||||||
return result;
|
return result;
|
||||||
|
voicescript->closeWriteChannel();
|
||||||
voicescript->waitForReadyRead();
|
voicescript->waitForReadyRead();
|
||||||
|
|
||||||
QString dataRaw = voicescript->readAllStandardError().data();
|
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";
|
QString query = "SPEAK\t"+wavfile+"\t"+text+"\r\n";
|
||||||
qDebug() << "voicing" << query;
|
qDebug() << "voicing" << query;
|
||||||
voicescript->write(query.toLocal8Bit());
|
*voicestream << query;
|
||||||
voicescript->write("SYNC\tbla\r\n");
|
*voicestream << "SYNC\tbla\r\n";
|
||||||
|
voicestream->flush();
|
||||||
voicescript->waitForReadyRead();
|
voicescript->waitForReadyRead();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTSSapi::stop()
|
bool TTSSapi::stop()
|
||||||
{
|
{
|
||||||
QString query = "QUIT\r\n";
|
|
||||||
voicescript->write(query.toLocal8Bit());
|
*voicestream << "QUIT\r\n";
|
||||||
|
voicestream->flush();
|
||||||
voicescript->waitForFinished();
|
voicescript->waitForFinished();
|
||||||
|
delete voicestream;
|
||||||
delete voicescript;
|
delete voicescript;
|
||||||
QFile::setPermissions(QDir::tempPath() +"/sapi_voice.vbs",QFile::ReadOwner |QFile::WriteOwner|QFile::ExeOwner
|
QFile::setPermissions(QDir::tempPath() +"/sapi_voice.vbs",QFile::ReadOwner |QFile::WriteOwner|QFile::ExeOwner
|
||||||
|QFile::ReadUser| QFile::WriteUser| QFile::ExeUser
|
|QFile::ReadUser| QFile::WriteUser| QFile::ExeUser
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class TTSSapi : public TTSBase
|
||||||
QStringList getVoiceList(QString language);
|
QStringList getVoiceList(QString language);
|
||||||
private:
|
private:
|
||||||
QProcess* voicescript;
|
QProcess* voicescript;
|
||||||
|
QTextStream* voicestream;
|
||||||
QString defaultLanguage;
|
QString defaultLanguage;
|
||||||
|
|
||||||
QString m_TTSexec;
|
QString m_TTSexec;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue