Commit 4abafb46 authored by Lorenz Meier's avatar Lorenz Meier

Disable tunes, allow to re-enable them with a simple define

parent e2a75529
...@@ -111,8 +111,11 @@ QT += network \ ...@@ -111,8 +111,11 @@ QT += network \
serialport \ serialport \
sql \ sql \
printsupport \ printsupport \
quick \ quick
multimedia
contains(DEFINES, QGC_NOTIFY_TUNES_ENABLED) {
QT += multimedia
}
!contains(DEFINES, DISABLE_GOOGLE_EARTH) { !contains(DEFINES, DISABLE_GOOGLE_EARTH) {
QT += webkit webkitwidgets QT += webkit webkitwidgets
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#include <QDebug> #include <QDebug>
#include <QCoreApplication> #include <QCoreApplication>
#include <QFile> #include <QFile>
#include <QSound>
#include "QGC.h" #include "QGC.h"
#include "QGCAudioWorker.h" #include "QGCAudioWorker.h"
...@@ -28,12 +27,14 @@ ...@@ -28,12 +27,14 @@
QGCAudioWorker::QGCAudioWorker(QObject *parent) : QGCAudioWorker::QGCAudioWorker(QObject *parent) :
QObject(parent), QObject(parent),
voiceIndex(0), voiceIndex(0),
emergency(false),
muted(false),
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
pVoice(NULL), pVoice(NULL),
#endif #endif
sound(NULL) #ifdef QGC_NOTIFY_TUNES_ENABLED
sound(NULL),
#endif
emergency(false),
muted(false)
{ {
// Load settings // Load settings
QSettings settings; QSettings settings;
...@@ -42,7 +43,9 @@ QGCAudioWorker::QGCAudioWorker(QObject *parent) : ...@@ -42,7 +43,9 @@ QGCAudioWorker::QGCAudioWorker(QObject *parent) :
void QGCAudioWorker::init() void QGCAudioWorker::init()
{ {
sound = new QSound(""); #ifdef QGC_NOTIFY_TUNES_ENABLED
sound = new QSound(":/files/audio/alert.wav");
#endif
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
espeak_Initialize(AUDIO_OUTPUT_SYNCH_PLAYBACK, 500, NULL, 0); // initialize for playback with 500ms buffer and no options (see speak_lib.h) espeak_Initialize(AUDIO_OUTPUT_SYNCH_PLAYBACK, 500, NULL, 0); // initialize for playback with 500ms buffer and no options (see speak_lib.h)
...@@ -98,10 +101,12 @@ void QGCAudioWorker::say(QString text, int severity) ...@@ -98,10 +101,12 @@ void QGCAudioWorker::say(QString text, int severity)
beep(); beep();
} }
#ifdef QGC_NOTIFY_TUNES_ENABLED
// Wait for the last sound to finish // Wait for the last sound to finish
while (!sound->isFinished()) { while (!sound->isFinished()) {
QGC::SLEEP::msleep(100); QGC::SLEEP::msleep(100);
} }
#endif
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
pVoice->Speak(text.toStdWString().c_str(), SPF_DEFAULT, NULL); pVoice->Speak(text.toStdWString().c_str(), SPF_DEFAULT, NULL);
...@@ -150,7 +155,9 @@ void QGCAudioWorker::beep() ...@@ -150,7 +155,9 @@ void QGCAudioWorker::beep()
if (!muted) if (!muted)
{ {
#ifdef QGC_NOTIFY_TUNES_ENABLED
sound->play(":/files/audio/alert.wav"); sound->play(":/files/audio/alert.wav");
#endif
} }
} }
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
#include <QObject> #include <QObject>
#include <QTimer> #include <QTimer>
#ifdef QGC_NOTIFY_TUNES_ENABLED
#include <QSound> #include <QSound>
#endif
/* For Snow leopard and later /* For Snow leopard and later
#if defined Q_OS_MAC & defined QGC_SPEECH_ENABLED #if defined Q_OS_MAC & defined QGC_SPEECH_ENABLED
...@@ -38,20 +40,16 @@ public slots: ...@@ -38,20 +40,16 @@ public slots:
void beep(); void beep();
protected: protected:
#if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms)
//NSSpeechSynthesizer
#endif
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
//cst_voice* voice; ///< The flite voice object
#endif
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
ISpVoice *pVoice; ISpVoice *pVoice;
#endif #endif
int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms) #ifdef QGC_NOTIFY_TUNES_ENABLED
QSound *sound;
#endif
bool emergency; ///< Emergency status flag bool emergency; ///< Emergency status flag
QTimer *emergencyTimer; QTimer *emergencyTimer;
bool muted; bool muted;
QSound *sound;
}; };
#endif // QGCAUDIOWORKER_H #endif // QGCAUDIOWORKER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment