Commit 1ea5313b authored by Bryant's avatar Bryant

Speech library now uses QGC_SPEECH_ENABLED macro.

parent beea5599
...@@ -532,24 +532,27 @@ MacBuild { ...@@ -532,24 +532,27 @@ MacBuild {
# #
contains (DEFINES, DISABLE_SPEECH) { contains (DEFINES, DISABLE_SPEECH) {
message("Skipping support for speech output (manual override)") message("Skipping support for speech output (manual override)")
DEFINES -= DISABLE_SPEECH
} else:LinuxBuild { } else:LinuxBuild {
exists(/usr/include/flite) | exists(/usr/local/include/flite) { exists(/usr/include/flite) | exists(/usr/local/include/flite) {
message("Including support for speech output") message("Including support for speech output")
DEFINES += QGC_SPEECH_ENABLED
LIBS += \ LIBS += \
-lflite_cmu_us_kal \ -lflite_cmu_us_kal \
-lflite_usenglish \ -lflite_usenglish \
-lflite_cmulex \ -lflite_cmulex \
-lflite -lflite
} else { } else {
DEFINES += DISABLE_SPEECH
warning("Skipping support for speech output (missing libraries, see README)") warning("Skipping support for speech output (missing libraries, see README)")
} }
} }
# Mac support is built into OS 10.6+. # Mac support is built into OS 10.6+.
else:MacBuild { else:MacBuild {
message("Including support for speech output") message("Including support for speech output")
DEFINES += QGC_SPEECH_ENABLED
} }
# Windows supports speech through native API. # Windows supports speech through native API.
else:WindowsBuild { else:WindowsBuild {
message("Including support for speech output") message("Including support for speech output")
DEFINES += QGC_SPEECH_ENABLED
} }
...@@ -37,12 +37,12 @@ This file is part of the QGROUNDCONTROL project ...@@ -37,12 +37,12 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug> #include <QDebug>
#if defined Q_OS_MAC && !defined DISABLE_SPEECH #if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#endif #endif
// Speech synthesis is only supported with MSVC compiler // Speech synthesis is only supported with MSVC compiler
#if defined _MSC_VER && !defined DISABLE_SPEECH #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx // Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#include <sapi.h> #include <sapi.h>
...@@ -50,14 +50,14 @@ This file is part of the QGROUNDCONTROL project ...@@ -50,14 +50,14 @@ This file is part of the QGROUNDCONTROL project
//using System.Speech.Synthesis; //using System.Speech.Synthesis;
#endif #endif
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
extern "C" { extern "C" {
#include <flite/flite.h> #include <flite/flite.h>
cst_voice *register_cmu_us_kal(const char *voxdir); cst_voice *register_cmu_us_kal(const char *voxdir);
}; };
#endif #endif
#if defined _MSC_VER && !defined DISABLE_SPEECH #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
ISpVoice *GAudioOutput::pVoice = NULL; ISpVoice *GAudioOutput::pVoice = NULL;
#endif #endif
...@@ -96,11 +96,11 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent), ...@@ -96,11 +96,11 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
muted = settings.value(QGC_GAUDIOOUTPUT_KEY + "muted", muted).toBool(); muted = settings.value(QGC_GAUDIOOUTPUT_KEY + "muted", muted).toBool();
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
flite_init(); flite_init();
#endif #endif
#if defined _MSC_VER && !defined DISABLE_SPEECH #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
pVoice = NULL; pVoice = NULL;
if (FAILED(::CoInitialize(NULL))) if (FAILED(::CoInitialize(NULL)))
...@@ -145,7 +145,7 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent), ...@@ -145,7 +145,7 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
GAudioOutput::~GAudioOutput() GAudioOutput::~GAudioOutput()
{ {
#if defined _MSC_VER && !defined DISABLE_SPEECH #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
pVoice->Release(); pVoice->Release();
pVoice = NULL; pVoice = NULL;
::CoUninitialize(); ::CoUninitialize();
...@@ -182,7 +182,7 @@ bool GAudioOutput::say(QString text, int severity) ...@@ -182,7 +182,7 @@ bool GAudioOutput::say(QString text, int severity)
{ {
// Speech synthesis is only supported with MSVC compiler // Speech synthesis is only supported with MSVC compiler
#if defined _MSC_VER && !defined DISABLE_SPEECH #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
/*SpeechSynthesizer synth = new SpeechSynthesizer(); /*SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SelectVoice("Microsoft Anna"); synth.SelectVoice("Microsoft Anna");
synth.SpeakText(text.toStdString().c_str()); synth.SpeakText(text.toStdString().c_str());
...@@ -205,7 +205,7 @@ bool GAudioOutput::say(QString text, int severity) ...@@ -205,7 +205,7 @@ bool GAudioOutput::say(QString text, int severity)
}*/ }*/
#endif #endif
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
QTemporaryFile file; QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav"); file.setFileTemplate("XXXXXX.wav");
...@@ -222,7 +222,7 @@ bool GAudioOutput::say(QString text, int severity) ...@@ -222,7 +222,7 @@ bool GAudioOutput::say(QString text, int severity)
#endif #endif
#if defined Q_OS_MAC && !defined DISABLE_SPEECH #if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED
// Slashes necessary to have the right start to the sentence // Slashes necessary to have the right start to the sentence
// copying data prevents SpeakString from reading additional chars // copying data prevents SpeakString from reading additional chars
text = "\\" + text; text = "\\" + text;
...@@ -339,14 +339,14 @@ void GAudioOutput::beep() ...@@ -339,14 +339,14 @@ void GAudioOutput::beep()
void GAudioOutput::selectFemaleVoice() void GAudioOutput::selectFemaleVoice()
{ {
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
//this->voice = register_cmu_us_slt(NULL); //this->voice = register_cmu_us_slt(NULL);
#endif #endif
} }
void GAudioOutput::selectMaleVoice() void GAudioOutput::selectMaleVoice()
{ {
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
//this->voice = register_cmu_us_rms(NULL); //this->voice = register_cmu_us_rms(NULL);
#endif #endif
} }
...@@ -354,7 +354,7 @@ void GAudioOutput::selectMaleVoice() ...@@ -354,7 +354,7 @@ void GAudioOutput::selectMaleVoice()
/* /*
void GAudioOutput::selectNeutralVoice() void GAudioOutput::selectNeutralVoice()
{ {
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
this->voice = register_cmu_us_awb(NULL); this->voice = register_cmu_us_awb(NULL);
#endif #endif
}*/ }*/
......
...@@ -40,7 +40,7 @@ This file is part of the PIXHAWK project ...@@ -40,7 +40,7 @@ This file is part of the PIXHAWK project
#include <AudioOutput> #include <AudioOutput>
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#if !defined DISABLE_SPEECH #if defined QGC_SPEECH_ENABLED
//#include <flite/flite.h> //#include <flite/flite.h>
#endif #endif
#include <phonon/MediaObject> #include <phonon/MediaObject>
...@@ -52,13 +52,13 @@ This file is part of the PIXHAWK project ...@@ -52,13 +52,13 @@ This file is part of the PIXHAWK project
#endif #endif
/* For Snow leopard and later /* For Snow leopard and later
#if defined Q_OS_MAC & !defined DISABLE_SPEECH #if defined Q_OS_MAC & defined QGC_SPEECH_ENABLED
#include <NSSpeechSynthesizer.h> #include <NSSpeechSynthesizer.h>
#endif #endif
*/ */
#if defined _MSC_VER && !defined DISABLE_SPEECH #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx // Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#include <sapi.h> #include <sapi.h>
#endif #endif
...@@ -111,13 +111,13 @@ signals: ...@@ -111,13 +111,13 @@ signals:
void mutedChanged(bool); void mutedChanged(bool);
protected: protected:
#if defined Q_OS_MAC && !defined DISABLE_SPEECH #if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED
//NSSpeechSynthesizer //NSSpeechSynthesizer
#endif #endif
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH #if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
//cst_voice* voice; ///< The flite voice object //cst_voice* voice; ///< The flite voice object
#endif #endif
#if defined _MSC_VER && !defined DISABLE_SPEECH #if defined _MSC_VER && defined QGC_SPEECH_ENABLED
static ISpVoice *pVoice; static ISpVoice *pVoice;
#endif #endif
int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms) int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms)
......
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