diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index c0c7b95cb055044fcada613fa37838a0136534fb..c4bc2398244d9ae83f428649f16d439121f3219c 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -92,10 +92,6 @@ QT += \ bluetooth \ } -contains(DEFINES, QGC_NOTIFY_TUNES_ENABLED) { - QT += multimedia -} - # testlib is needed even in release flavor for QSignalSpy support QT += testlib diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index e8804f9fd82dc2099b04c42f70e973c2b4fb6321..673172ba9d4c4b5456dc18c9cad4d3549f8004b7 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -88,12 +88,11 @@ bool GAudioOutput::isMuted() return muted; } -bool GAudioOutput::say(const QString& inText, int severity) +bool GAudioOutput::say(const QString& inText) { - if (!muted) { + if (!muted && !qgcApp()->runningUnitTests()) { #if defined __android__ #if defined QGC_SPEECH_ENABLED - Q_UNUSED(severity); static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"}; QAndroidJniEnvironment env; if (env->ExceptionCheck()) { @@ -105,7 +104,7 @@ bool GAudioOutput::say(const QString& inText, int severity) QAndroidJniObject::callStaticMethod(V_jniClassName, "say", "(Ljava/lang/String;)V", javaMessage.object()); #endif #else - emit textToSpeak(inText, severity); + emit textToSpeak(inText); #endif } return true; diff --git a/src/GAudioOutput.h b/src/GAudioOutput.h index c121c6826df8b67952104f302371aec8b04ae05d..50bb46843bbd01fd687c55098c355b4e2e729aa7 100644 --- a/src/GAudioOutput.h +++ b/src/GAudioOutput.h @@ -79,14 +79,14 @@ public: bool isMuted(); public slots: - /** @brief Say this text if current output priority matches */ - bool say(const QString& text, int severity = 6); + /** @brief Say this text */ + bool say(const QString& text); /** @brief Mute/unmute sound */ void mute(bool mute); signals: void mutedChanged(bool); - bool textToSpeak(QString text, int severity = 1); + bool textToSpeak(QString text); void beepOnce(); protected: diff --git a/src/audio/QGCAudioWorker.cpp b/src/audio/QGCAudioWorker.cpp index 10e2e33284fee7be3dca2f19504c0a240e02c226..d64101b941a224d05f638062b0a38af88c19faee 100644 --- a/src/audio/QGCAudioWorker.cpp +++ b/src/audio/QGCAudioWorker.cpp @@ -76,9 +76,6 @@ QGCAudioWorker::QGCAudioWorker(QObject *parent) : #if defined _MSC_VER && defined QGC_SPEECH_ENABLED pVoice(NULL), #endif - #ifdef QGC_NOTIFY_TUNES_ENABLED - sound(NULL), - #endif emergency(false), muted(false) { @@ -89,10 +86,6 @@ QGCAudioWorker::QGCAudioWorker(QObject *parent) : void QGCAudioWorker::init() { -#ifdef QGC_NOTIFY_TUNES_ENABLED - sound = new QSound(":/res/Alert"); -#endif - #if defined Q_OS_LINUX && !defined __android__ && 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_VOICE *espeak_voice = espeak_GetCurrentVoice(); @@ -135,11 +128,10 @@ QGCAudioWorker::~QGCAudioWorker() #endif } -void QGCAudioWorker::say(QString inText, int severity) +void QGCAudioWorker::say(QString inText) { #ifdef __android__ Q_UNUSED(inText); - Q_UNUSED(severity); #else static bool threadInit = false; if (!threadInit) { @@ -150,17 +142,6 @@ void QGCAudioWorker::say(QString inText, int severity) if (!muted) { QString text = fixTextMessageForAudio(inText); - // Prepend high priority text with alert beep - if (severity < GAudioOutput::AUDIO_SEVERITY_CRITICAL) { - beep(); - } - -#ifdef QGC_NOTIFY_TUNES_ENABLED - // Wait for the last sound to finish - while (!sound->isFinished()) { - QGC::SLEEP::msleep(100); - } -#endif #if defined _MSC_VER && defined QGC_SPEECH_ENABLED HRESULT hr = pVoice->Speak(text.toStdWString().c_str(), SPF_DEFAULT, NULL); @@ -195,17 +176,6 @@ void QGCAudioWorker::mute(bool mute) } } -void QGCAudioWorker::beep() -{ - - if (!muted) - { -#ifdef QGC_NOTIFY_TUNES_ENABLED - sound->play(":/res/Alert"); -#endif - } -} - bool QGCAudioWorker::isMuted() { return this->muted; diff --git a/src/audio/QGCAudioWorker.h b/src/audio/QGCAudioWorker.h index cf93ff4c6f8c63b6c81e8770342cc1bf6a499917..a48d404faf8d912224a04b548842b20b6663511d 100644 --- a/src/audio/QGCAudioWorker.h +++ b/src/audio/QGCAudioWorker.h @@ -3,9 +3,6 @@ #include #include -#ifdef QGC_NOTIFY_TUNES_ENABLED -#include -#endif #if defined _MSC_VER && defined QGC_SPEECH_ENABLED // Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx @@ -29,19 +26,13 @@ public: signals: public slots: - /** @brief Say this text if current output priority matches */ - void say(QString text, int severity = 1); - - /** @brief Sound a single beep */ - void beep(); + /** @brief Say this text */ + void say(QString text); protected: int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms) #if defined _MSC_VER && defined QGC_SPEECH_ENABLED ISpVoice *pVoice; -#endif -#ifdef QGC_NOTIFY_TUNES_ENABLED - QSound *sound; #endif bool emergency; ///< Emergency status flag QTimer *emergencyTimer;