QGCAudioWorker.h 1.3 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 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

/* For Snow leopard and later
#if defined Q_OS_MAC & defined QGC_SPEECH_ENABLED
#include <NSSpeechSynthesizer.h>
#endif
   */


#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#include <sapi.h>
#endif

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

    void mute(bool mute);
    bool isMuted();
31
    void init();
32 33 34 35 36 37 38

signals:

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

39 40 41
    /** @brief Sound a single beep */
    void beep();

42
protected:
43
    int voiceIndex;   ///< The index of the flite voice to use (awb, slt, rms)
44
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
45
    ISpVoice *pVoice;
46
#endif
47 48 49
#ifdef QGC_NOTIFY_TUNES_ENABLED
    QSound *sound;
#endif
50 51 52
    bool emergency;   ///< Emergency status flag
    QTimer *emergencyTimer;
    bool muted;
53
private:
54
    QString _fixTextMessageForAudio(const QString& string);
55
    bool _getMillisecondString(const QString& string, QString& match, int& number);
56 57 58
};

#endif // QGCAUDIOWORKER_H