QGCAudioWorker.h 1.21 KB
Newer Older
1 2 3 4 5
#ifndef QGCAUDIOWORKER_H
#define QGCAUDIOWORKER_H

#include <QObject>
#include <QTimer>
6
#ifdef QGC_NOTIFY_TUNES_ENABLED
7
#include <QSound>
8
#endif
9 10 11

#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
Don Gagne's avatar
Don Gagne committed
12
#include <basetyps.h>
13 14 15 16 17 18 19 20 21 22 23 24
#include <sapi.h>
#endif

class QGCAudioWorker : public QObject
{
    Q_OBJECT
public:
    explicit QGCAudioWorker(QObject *parent = 0);
    ~QGCAudioWorker();

    void mute(bool mute);
    bool isMuted();
25
    void init();
26

dogmaphobic's avatar
dogmaphobic committed
27 28
    static QString fixTextMessageForAudio(const QString& string);

29 30 31 32 33 34
signals:

public slots:
    /** @brief Say this text if current output priority matches */
    void say(QString text, int severity = 1);

35 36 37
    /** @brief Sound a single beep */
    void beep();

38
protected:
39
    int voiceIndex;   ///< The index of the flite voice to use (awb, slt, rms)
40
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
41
    ISpVoice *pVoice;
42
#endif
43 44 45
#ifdef QGC_NOTIFY_TUNES_ENABLED
    QSound *sound;
#endif
46 47 48
    bool emergency;   ///< Emergency status flag
    QTimer *emergencyTimer;
    bool muted;
49
private:
dogmaphobic's avatar
dogmaphobic committed
50
    static bool _getMillisecondString(const QString& string, QString& match, int& number);
51 52 53
};

#endif // QGCAUDIOWORKER_H