AudioOutput.h 1.11 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
pixhawk's avatar
pixhawk committed
9

10
#pragma once
pixhawk's avatar
pixhawk committed
11 12 13

#include <QObject>
#include <QTimer>
14
#include <QThread>
pixhawk's avatar
pixhawk committed
15
#include <QStringList>
16
#include <QTextToSpeech>
17

18 19 20
#include "QGCToolbox.h"

class QGCApplication;
Lorenz Meier's avatar
Lorenz Meier committed
21

22
/// Text to Speech Interface
23
class AudioOutput : public QGCTool
pixhawk's avatar
pixhawk committed
24 25 26
{
    Q_OBJECT
public:
27
    AudioOutput(QGCApplication* app, QGCToolbox* toolbox);
pixhawk's avatar
pixhawk committed
28

29 30
    static bool     getMillisecondString    (const QString& string, QString& match, int& number);
    static QString  fixTextMessageForAudio  (const QString& string);
31

pixhawk's avatar
pixhawk committed
32
public slots:
33
    /// Convert string to speech output and say it
Don Gagne's avatar
Don Gagne committed
34
    void            say                     (const QString& text);
35

36 37
private slots:
    void            _stateChanged           (QTextToSpeech::State state);
pixhawk's avatar
pixhawk committed
38 39

protected:
40 41
    QTextToSpeech*  _tts;
    QStringList     _texts;
pixhawk's avatar
pixhawk committed
42 43
};