diff --git a/rbutil/rbutilqt/tts.cpp b/rbutil/rbutilqt/tts.cpp index c603e148f1..76eacd54ca 100644 --- a/rbutil/rbutilqt/tts.cpp +++ b/rbutil/rbutilqt/tts.cpp @@ -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 diff --git a/rbutil/rbutilqt/tts.h b/rbutil/rbutilqt/tts.h index f73114b8c1..7c21fd0d65 100644 --- a/rbutil/rbutilqt/tts.h +++ b/rbutil/rbutilqt/tts.h @@ -81,7 +81,7 @@ class TTSSapi : public TTSBase QStringList getVoiceList(QString language); private: QProcess* voicescript; - + QTextStream* voicestream; QString defaultLanguage; QString m_TTSexec;