TTS: check if created wav file exists.
Instead of simply assuming the wav file that is supposed to be created by the TTS engine check if the file actually exists and return an error if not. Change-Id: I9e4a85a061b44b48931614602683b1dfe7dfce67
This commit is contained in:
parent
6e11289cc2
commit
633749ea61
2 changed files with 10 additions and 1 deletions
|
@ -83,8 +83,13 @@ TTSStatus TTSExes::voice(QString text,QString wavfile, QString *errStr)
|
|||
execstring.replace("%options",m_TTSOpts);
|
||||
execstring.replace("%wavfile",wavfile);
|
||||
execstring.replace("%text",text);
|
||||
//qDebug() << "voicing" << execstring;
|
||||
|
||||
QProcess::execute(execstring);
|
||||
|
||||
if(!QFileInfo(wavfile).isFile()) {
|
||||
qDebug() << "[TTSExes] output file does not exist:" << wavfile;
|
||||
return FatalError;
|
||||
}
|
||||
return NoError;
|
||||
|
||||
}
|
||||
|
|
|
@ -233,6 +233,10 @@ TTSStatus TTSSapi::voice(QString text,QString wavfile, QString *errStr)
|
|||
while( voicescript->readLine(temp,20) == 0)
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
if(!QFileInfo(wavfile).isFile()) {
|
||||
qDebug() << "[TTSExes] output file does not exist:" << wavfile;
|
||||
return FatalError;
|
||||
}
|
||||
return NoError;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue