GAudioOutput.h 1.68 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * 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 11 12 13 14 15 16 17 18 19 20 21 22 23


/**
 * @file
 *   @brief Definition of audio output
 *
 *   @author Lorenz Meier <mavteam@student.ethz.ch>
 *
 */

#ifndef GAUDIOOUTPUT_H
#define GAUDIOOUTPUT_H

#include <QObject>
#include <QTimer>
24
#include <QThread>
pixhawk's avatar
pixhawk committed
25
#include <QStringList>
26

27
#include "QGCAudioWorker.h"
28 29 30
#include "QGCToolbox.h"

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

pixhawk's avatar
pixhawk committed
32 33 34 35 36
/**
 * @brief Audio Output (speech synthesizer and "beep" output)
 * This class follows the singleton design pattern
 * @see http://en.wikipedia.org/wiki/Singleton_pattern
 */
37
class GAudioOutput : public QGCTool
pixhawk's avatar
pixhawk committed
38 39
{
    Q_OBJECT
dogmaphobic's avatar
dogmaphobic committed
40

pixhawk's avatar
pixhawk committed
41
public:
42 43 44
    GAudioOutput(QGCApplication* app);
    ~GAudioOutput();

pixhawk's avatar
pixhawk committed
45 46
    /** @brief List available voices */
    QStringList listVoices(void);
Lorenz Meier's avatar
Lorenz Meier committed
47 48
    enum
    {
49 50 51
        VOICE_MALE = 0,
        VOICE_FEMALE
    } QGVoice;
pixhawk's avatar
pixhawk committed
52

53 54 55 56 57 58 59 60 61 62 63 64
    enum AUDIO_SEVERITY
    {
        AUDIO_SEVERITY_EMERGENCY = 0,
        AUDIO_SEVERITY_ALERT = 1,
        AUDIO_SEVERITY_CRITICAL = 2,
        AUDIO_SEVERITY_ERROR = 3,
        AUDIO_SEVERITY_WARNING = 4,
        AUDIO_SEVERITY_NOTICE = 5,
        AUDIO_SEVERITY_INFO = 6,
        AUDIO_SEVERITY_DEBUG = 7
    };

pixhawk's avatar
pixhawk committed
65
public slots:
Don Gagne's avatar
Don Gagne committed
66 67
    /** @brief Say this text */
    bool say(const QString& text);
68 69

signals:
Don Gagne's avatar
Don Gagne committed
70
    bool textToSpeak(QString text);
71
    void beepOnce();
pixhawk's avatar
pixhawk committed
72 73

protected:
dogmaphobic's avatar
dogmaphobic committed
74
#if !defined __android__
75 76
    QThread* thread;
    QGCAudioWorker* worker;
dogmaphobic's avatar
dogmaphobic committed
77
#endif
pixhawk's avatar
pixhawk committed
78 79 80
};

#endif // AUDIOOUTPUT_H
Lorenz Meier's avatar
Lorenz Meier committed
81