Skip to content
Snippets Groups Projects
GAudioOutput.h 1.7 KiB
Newer Older
  • Learn to ignore specific revisions
  • /****************************************************************************
     *
     *   (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
    
    
    /**
     * @file
     *   @brief Definition of audio output
     *
     *   @author Lorenz Meier <mavteam@student.ethz.ch>
     *
     */
    
    #ifndef GAUDIOOUTPUT_H
    #define GAUDIOOUTPUT_H
    
    #include <QObject>
    #include <QTimer>
    
    #include <QThread>
    
    pixhawk's avatar
    pixhawk committed
    #include <QStringList>
    
    #include "QGCAudioWorker.h"
    
    #include "QGCToolbox.h"
    
    class QGCApplication;
    
    Lorenz Meier's avatar
    Lorenz Meier committed
    
    
    pixhawk's avatar
    pixhawk committed
    /**
     * @brief Audio Output (speech synthesizer and "beep" output)
     * This class follows the singleton design pattern
     * @see http://en.wikipedia.org/wiki/Singleton_pattern
     */
    
    class GAudioOutput : public QGCTool
    
    pixhawk's avatar
    pixhawk committed
    {
        Q_OBJECT
    
    dogmaphobic's avatar
    dogmaphobic committed
    
    
    pixhawk's avatar
    pixhawk committed
    public:
    
        GAudioOutput(QGCApplication* app, QGCToolbox* toolbox);
    
        ~GAudioOutput();
    
    
    pixhawk's avatar
    pixhawk committed
        /** @brief List available voices */
        QStringList listVoices(void);
    
    Lorenz Meier's avatar
    Lorenz Meier committed
        enum
        {
    
            VOICE_MALE = 0,
            VOICE_FEMALE
        } QGVoice;
    
    pixhawk's avatar
    pixhawk committed
    
    
        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
    public slots:
    
    Don Gagne's avatar
    Don Gagne committed
        /** @brief Say this text */
        bool say(const QString& text);
    
    Don Gagne's avatar
    Don Gagne committed
        bool textToSpeak(QString text);
    
        void beepOnce();
    
    pixhawk's avatar
    pixhawk committed
    
    protected:
    
    dogmaphobic's avatar
    dogmaphobic committed
    #if !defined __android__
    
        QThread* thread;
        QGCAudioWorker* worker;
    
    dogmaphobic's avatar
    dogmaphobic committed
    #endif
    
    pixhawk's avatar
    pixhawk committed
    };
    
    #endif // AUDIOOUTPUT_H
    
    Lorenz Meier's avatar
    Lorenz Meier committed