mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
rbutil: ttsqt: Bail if TTS engine doesn't support saving to file
Change-Id: Iaac0f77836727e5d8853d32a0b47c5d8d62b3365
This commit is contained in:
parent
acba3fcb07
commit
d33d2f0840
1 changed files with 13 additions and 6 deletions
|
|
@ -29,6 +29,8 @@
|
||||||
#include <QtTextToSpeech/QTextToSpeech>
|
#include <QtTextToSpeech/QTextToSpeech>
|
||||||
#include <QtMultimedia/QAudioFormat>
|
#include <QtMultimedia/QAudioFormat>
|
||||||
|
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
TTSQt::TTSQt(QObject *parent) : TTSBase(parent)
|
TTSQt::TTSQt(QObject *parent) : TTSBase(parent)
|
||||||
{
|
{
|
||||||
m_tts = new QTextToSpeech(this);
|
m_tts = new QTextToSpeech(this);
|
||||||
|
|
@ -50,12 +52,6 @@ TTSStatus TTSQt::voice(const QString& text, const QString& wavfile, QString* err
|
||||||
return Warning;
|
return Warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the current engine supports synthesis (requires Qt 6.6+)
|
|
||||||
if (!wavfile.isEmpty() && !(m_tts->engineCapabilities() & QTextToSpeech::Capability::Synthesize)) {
|
|
||||||
if (errStr) *errStr = "Current TTS engine does not support synthesis to file";
|
|
||||||
return FatalError;
|
|
||||||
}
|
|
||||||
|
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
|
|
@ -131,6 +127,17 @@ bool TTSQt::start(QString *errStr)
|
||||||
if (errStr) *errStr = "No TTS engines available on this system";
|
if (errStr) *errStr = "No TTS engines available on this system";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX figure out the "best" engine. Ignore 'mock' and
|
||||||
|
// any anything that doesn't support file output!
|
||||||
|
|
||||||
|
if (!(m_tts->engineCapabilities() & QTextToSpeech::Capability::Synthesize)) {
|
||||||
|
LOG_ERROR() << "QT TTS engine '" << m_tts->engine() << " does not support synthesis to file";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_INFO() << "QT TTS engine: " << m_tts->engine();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue