Improve error handling and logging.
- Fix a warning - Log an error if the file to encode cannot be read. - Adjust some log strings.
This commit is contained in:
parent
b17bdb9349
commit
42fa2a8d0f
3 changed files with 19 additions and 12 deletions
|
@ -84,7 +84,7 @@ bool EncoderLame::start()
|
|||
|
||||
bool EncoderLame::encode(QString input,QString output)
|
||||
{
|
||||
qDebug() << "[EncoderLame] Encoding" << input;
|
||||
qDebug() << "[EncoderLame] Encoding" << QDir::cleanPath(input);
|
||||
if(!m_symbolsResolved) {
|
||||
qDebug() << "[EncoderLame] Symbols not successfully resolved, cannot run!";
|
||||
return false;
|
||||
|
@ -113,11 +113,14 @@ bool EncoderLame::encode(QString input,QString output)
|
|||
m_lame_set_scale(gfp, 1.0); // scale input volume
|
||||
m_lame_set_mode(gfp, MONO); // mono output mode
|
||||
m_lame_set_VBR(gfp, vbr_default); // enable default VBR mode
|
||||
m_lame_set_VBR_quality(gfp, 9.999); // VBR quality
|
||||
m_lame_set_VBR_quality(gfp, 9.999f); // VBR quality
|
||||
m_lame_set_VBR_max_bitrate_kbps(gfp, 64); // maximum bitrate 64kbps
|
||||
m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag.
|
||||
|
||||
fin.open(QIODevice::ReadOnly);
|
||||
if(!fin.open(QIODevice::ReadOnly)) {
|
||||
qDebug() << "[EncoderLame] Could not open input file" << input;
|
||||
return false;
|
||||
}
|
||||
|
||||
// read RIFF header
|
||||
fin.read((char*)header, 12);
|
||||
|
|
|
@ -286,8 +286,9 @@ void TalkGenerator::encProgress(int value)
|
|||
|
||||
void TalkGenerator::encFailEntry(const TalkEntry& entry)
|
||||
{
|
||||
emit logItem(tr("Encoding of %1 failed").arg(entry.wavfilename), LOGERROR);
|
||||
abort();
|
||||
emit logItem(tr("Encoding of %1 failed").arg(
|
||||
QFileInfo(entry.wavfilename).baseName()), LOGERROR);
|
||||
abort();
|
||||
}
|
||||
|
||||
//! \brief slot, which is connected to the abort of the Logger. Sets a flag, so Creating Talkfiles ends at the next possible position
|
||||
|
|
|
@ -103,7 +103,7 @@ bool TTSSapi::start(QString *errStr)
|
|||
QFileInfo tts(m_TTSexec);
|
||||
if(!tts.exists())
|
||||
{
|
||||
*errStr = tr("Could not copy the Sapi-script");
|
||||
*errStr = tr("Could not copy the SAPI script");
|
||||
return false;
|
||||
}
|
||||
// create the voice process
|
||||
|
@ -117,14 +117,15 @@ bool TTSSapi::start(QString *errStr)
|
|||
if(m_sapi4)
|
||||
execstring.append(" /sapi4 ");
|
||||
|
||||
qDebug() << "init" << execstring;
|
||||
qDebug() << "[TTSSapi] Start:" << execstring;
|
||||
voicescript = new QProcess(NULL);
|
||||
//connect(voicescript,SIGNAL(readyReadStandardError()),this,SLOT(error()));
|
||||
|
||||
voicescript->start(execstring);
|
||||
qDebug() << "[TTSSapi] wait for process";
|
||||
if(!voicescript->waitForStarted())
|
||||
{
|
||||
*errStr = tr("Could not start the Sapi-script");
|
||||
*errStr = tr("Could not start SAPI process");
|
||||
qDebug() << "[TTSSapi] starting process timed out!";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -181,12 +182,14 @@ QStringList TTSSapi::getVoiceList(QString language)
|
|||
if(RbSettings::value(RbSettings::TtsUseSapi4).toBool())
|
||||
execstring.append(" /sapi4 ");
|
||||
|
||||
qDebug() << "init" << execstring;
|
||||
qDebug() << "[TTSSapi] Start:" << execstring;
|
||||
voicescript = new QProcess(NULL);
|
||||
voicescript->start(execstring);
|
||||
qDebug() << "wait for started";
|
||||
if(!voicescript->waitForStarted())
|
||||
qDebug() << "[TTSSapi] wait for process";
|
||||
if(!voicescript->waitForStarted()) {
|
||||
qDebug() << "[TTSSapi] process startup timed out!";
|
||||
return result;
|
||||
}
|
||||
voicescript->closeWriteChannel();
|
||||
voicescript->waitForReadyRead();
|
||||
|
||||
|
|
Loading…
Reference in a new issue