rbutil: ttsqt: Bail if TTS engine doesn't support saving to file

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Thu, 9 Jul 2026 20:33:44 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit d33d2f0840dfc05880dbfd4115d97ad05217e8b3
Author: Solomon Peachy <[email protected]>
Date:   Thu Jul 9 20:31:39 2026 -0400

    rbutil: ttsqt:  Bail if TTS engine doesn't support saving to file
    
    Change-Id: Iaac0f77836727e5d8853d32a0b47c5d8d62b3365

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 <QtTextToSpeech/QTextToSpeech>
 #include <QtMultimedia/QAudioFormat>
 
+#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;
 }
 
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs