rockbox/utils/rbutilqt/base/ttsqt.h
Solomon Peachy 931fbb6734 rbutilqt: QtTTS: Pick a sane TTS engine/backend by default
* Ignore 'mock' tts engine
 * Must support synthesizing to a file (ie not just "speaking")
 * Don't claim 'speak' capabilities if the chosen engine does not

Change-Id: Id5fd224466ed62df5af837256fa66a340672d167
2026-07-10 08:08:39 -04:00

55 lines
1.7 KiB
C++

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2026 by Vencislav Atanasov
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef TTSQT_H
#define TTSQT_H
#include <QtCore>
#include "ttsbase.h"
#include <QtTextToSpeech/QTextToSpeech>
#include <QtMultimedia/QAudioFormat>
class TTSQt : public TTSBase
{
Q_OBJECT
public:
explicit TTSQt(QObject *parent = nullptr);
~TTSQt() override;
TTSStatus voice(const QString& text, const QString& wavfile, QString* errStr) override;
bool start(QString *errStr) override;
bool stop() override;
QString voiceVendor(void) override;
bool configOk() override;
void generateSettings() override;
void saveSettings() override;
Capabilities capabilities() override;
private:
QTextToSpeech *m_tts = nullptr;
QByteArray m_audioData;
QAudioFormat m_format;
QStringList m_engines;
// Helper to write raw PCM data to a WAV file
bool writeWavFile(const QString &filePath, const QByteArray &audioData, const QAudioFormat &format);
};
#endif // TTSQT_H