Fix wavtrim on voicefile creation.

Pass the threshold value for wavtrim to the TalkGenerator object instead of
using the default value. Makes wavtrim to be actually used.

Furthermore, check the result of the wavtrim call and respect its return value.
This commit is contained in:
Dominik Riebeling 2012-01-15 12:24:54 +01:00
parent 7f26a10d31
commit 9db5c124af
2 changed files with 11 additions and 4 deletions

View file

@ -145,7 +145,8 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
// voice entry
QString error;
qDebug() << "[TalkGenerator] voicing: " << list->at(i).toSpeak << "to" << list->at(i).wavfilename;
qDebug() << "[TalkGenerator] voicing: " << list->at(i).toSpeak
<< "to" << list->at(i).wavfilename;
TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error);
if(status == Warning)
{
@ -162,11 +163,17 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
else
(*list)[i].voiced = true;
//wavetrim if needed
// wavtrim if needed
if(wavtrimth != -1)
{
char buffer[255];
wavtrim(list->at(i).wavfilename.toLocal8Bit().data(),wavtrimth,buffer,255);
if(wavtrim(list->at(i).wavfilename.toLocal8Bit().data(),
wavtrimth, buffer, 255))
{
qDebug() << "[TalkGenerator] wavtrim returned error on"
<< list->at(i).wavfilename;
return eERROR;
}
}
emit logProgress(++m_progress,progressMax);

View file

@ -187,7 +187,7 @@ void VoiceFileCreator::downloadDone(bool error)
connect(&generator,SIGNAL(logProgress(int,int)),this,SIGNAL(logProgress(int,int)));
connect(this,SIGNAL(aborted()),&generator,SLOT(abort()));
if(generator.process(&m_talkList) == TalkGenerator::eERROR)
if(generator.process(&m_talkList, m_wavtrimThreshold) == TalkGenerator::eERROR)
{
cleanup();
emit logProgress(0,1);