mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
* 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
55 lines
1.7 KiB
C++
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
|