From d33d2f0840dfc05880dbfd4115d97ad05217e8b3 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 9 Jul 2026 20:31:39 -0400 Subject: [PATCH] rbutil: ttsqt: Bail if TTS engine doesn't support saving to file Change-Id: Iaac0f77836727e5d8853d32a0b47c5d8d62b3365 --- utils/rbutilqt/base/ttsqt.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/utils/rbutilqt/base/ttsqt.cpp b/utils/rbutilqt/base/ttsqt.cpp index e7bcb110ac..88aa2ee90e 100644 --- a/utils/rbutilqt/base/ttsqt.cpp +++ b/utils/rbutilqt/base/ttsqt.cpp @@ -29,6 +29,8 @@ #include #include +#include "Logger.h" + TTSQt::TTSQt(QObject *parent) : TTSBase(parent) { m_tts = new QTextToSpeech(this); @@ -50,12 +52,6 @@ TTSStatus TTSQt::voice(const QString& text, const QString& wavfile, QString* err 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; bool success = true; QString errorMsg; @@ -131,6 +127,17 @@ bool TTSQt::start(QString *errStr) if (errStr) *errStr = "No TTS engines available on this system"; 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; }