summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-01-11 20:18:26 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-01-14 12:14:49 +0100
commit42fa2a8d0f6891f2d64eeb4de1920655f784e79a (patch)
tree45ca0d5b5f162aa705b5376347171dcc59f08a41 /rbutil/rbutilqt/base
parentb17bdb93493eec82fa60f5e0f008aa292aed6f10 (diff)
downloadrockbox-42fa2a8d0f6891f2d64eeb4de1920655f784e79a.tar.gz
rockbox-42fa2a8d0f6891f2d64eeb4de1920655f784e79a.zip
Improve error handling and logging.
- Fix a warning - Log an error if the file to encode cannot be read. - Adjust some log strings.
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r--rbutil/rbutilqt/base/encoderlame.cpp9
-rw-r--r--rbutil/rbutilqt/base/talkgenerator.cpp5
-rw-r--r--rbutil/rbutilqt/base/ttssapi.cpp17
3 files changed, 19 insertions, 12 deletions
diff --git a/rbutil/rbutilqt/base/encoderlame.cpp b/rbutil/rbutilqt/base/encoderlame.cpp
index d85453c49b..52937e9109 100644
--- a/rbutil/rbutilqt/base/encoderlame.cpp
+++ b/rbutil/rbutilqt/base/encoderlame.cpp
@@ -84,7 +84,7 @@ bool EncoderLame::start()
84 84
85bool EncoderLame::encode(QString input,QString output) 85bool EncoderLame::encode(QString input,QString output)
86{ 86{
87 qDebug() << "[EncoderLame] Encoding" << input; 87 qDebug() << "[EncoderLame] Encoding" << QDir::cleanPath(input);
88 if(!m_symbolsResolved) { 88 if(!m_symbolsResolved) {
89 qDebug() << "[EncoderLame] Symbols not successfully resolved, cannot run!"; 89 qDebug() << "[EncoderLame] Symbols not successfully resolved, cannot run!";
90 return false; 90 return false;
@@ -113,11 +113,14 @@ bool EncoderLame::encode(QString input,QString output)
113 m_lame_set_scale(gfp, 1.0); // scale input volume 113 m_lame_set_scale(gfp, 1.0); // scale input volume
114 m_lame_set_mode(gfp, MONO); // mono output mode 114 m_lame_set_mode(gfp, MONO); // mono output mode
115 m_lame_set_VBR(gfp, vbr_default); // enable default VBR mode 115 m_lame_set_VBR(gfp, vbr_default); // enable default VBR mode
116 m_lame_set_VBR_quality(gfp, 9.999); // VBR quality 116 m_lame_set_VBR_quality(gfp, 9.999f); // VBR quality
117 m_lame_set_VBR_max_bitrate_kbps(gfp, 64); // maximum bitrate 64kbps 117 m_lame_set_VBR_max_bitrate_kbps(gfp, 64); // maximum bitrate 64kbps
118 m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag. 118 m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag.
119 119
120 fin.open(QIODevice::ReadOnly); 120 if(!fin.open(QIODevice::ReadOnly)) {
121 qDebug() << "[EncoderLame] Could not open input file" << input;
122 return false;
123 }
121 124
122 // read RIFF header 125 // read RIFF header
123 fin.read((char*)header, 12); 126 fin.read((char*)header, 12);
diff --git a/rbutil/rbutilqt/base/talkgenerator.cpp b/rbutil/rbutilqt/base/talkgenerator.cpp
index 427df0ed1d..4e78872240 100644
--- a/rbutil/rbutilqt/base/talkgenerator.cpp
+++ b/rbutil/rbutilqt/base/talkgenerator.cpp
@@ -286,8 +286,9 @@ void TalkGenerator::encProgress(int value)
286 286
287void TalkGenerator::encFailEntry(const TalkEntry& entry) 287void TalkGenerator::encFailEntry(const TalkEntry& entry)
288{ 288{
289 emit logItem(tr("Encoding of %1 failed").arg(entry.wavfilename), LOGERROR); 289 emit logItem(tr("Encoding of %1 failed").arg(
290 abort(); 290 QFileInfo(entry.wavfilename).baseName()), LOGERROR);
291 abort();
291} 292}
292 293
293//! \brief slot, which is connected to the abort of the Logger. Sets a flag, so Creating Talkfiles ends at the next possible position 294//! \brief slot, which is connected to the abort of the Logger. Sets a flag, so Creating Talkfiles ends at the next possible position
diff --git a/rbutil/rbutilqt/base/ttssapi.cpp b/rbutil/rbutilqt/base/ttssapi.cpp
index 4c18ceff2a..b5e6a69624 100644
--- a/rbutil/rbutilqt/base/ttssapi.cpp
+++ b/rbutil/rbutilqt/base/ttssapi.cpp
@@ -103,7 +103,7 @@ bool TTSSapi::start(QString *errStr)
103 QFileInfo tts(m_TTSexec); 103 QFileInfo tts(m_TTSexec);
104 if(!tts.exists()) 104 if(!tts.exists())
105 { 105 {
106 *errStr = tr("Could not copy the Sapi-script"); 106 *errStr = tr("Could not copy the SAPI script");
107 return false; 107 return false;
108 } 108 }
109 // create the voice process 109 // create the voice process
@@ -117,14 +117,15 @@ bool TTSSapi::start(QString *errStr)
117 if(m_sapi4) 117 if(m_sapi4)
118 execstring.append(" /sapi4 "); 118 execstring.append(" /sapi4 ");
119 119
120 qDebug() << "init" << execstring; 120 qDebug() << "[TTSSapi] Start:" << execstring;
121 voicescript = new QProcess(NULL); 121 voicescript = new QProcess(NULL);
122 //connect(voicescript,SIGNAL(readyReadStandardError()),this,SLOT(error())); 122 //connect(voicescript,SIGNAL(readyReadStandardError()),this,SLOT(error()));
123
124 voicescript->start(execstring); 123 voicescript->start(execstring);
124 qDebug() << "[TTSSapi] wait for process";
125 if(!voicescript->waitForStarted()) 125 if(!voicescript->waitForStarted())
126 { 126 {
127 *errStr = tr("Could not start the Sapi-script"); 127 *errStr = tr("Could not start SAPI process");
128 qDebug() << "[TTSSapi] starting process timed out!";
128 return false; 129 return false;
129 } 130 }
130 131
@@ -181,12 +182,14 @@ QStringList TTSSapi::getVoiceList(QString language)
181 if(RbSettings::value(RbSettings::TtsUseSapi4).toBool()) 182 if(RbSettings::value(RbSettings::TtsUseSapi4).toBool())
182 execstring.append(" /sapi4 "); 183 execstring.append(" /sapi4 ");
183 184
184 qDebug() << "init" << execstring; 185 qDebug() << "[TTSSapi] Start:" << execstring;
185 voicescript = new QProcess(NULL); 186 voicescript = new QProcess(NULL);
186 voicescript->start(execstring); 187 voicescript->start(execstring);
187 qDebug() << "wait for started"; 188 qDebug() << "[TTSSapi] wait for process";
188 if(!voicescript->waitForStarted()) 189 if(!voicescript->waitForStarted()) {
190 qDebug() << "[TTSSapi] process startup timed out!";
189 return result; 191 return result;
192 }
190 voicescript->closeWriteChannel(); 193 voicescript->closeWriteChannel();
191 voicescript->waitForReadyRead(); 194 voicescript->waitForReadyRead();
192 195