Commit ebbb7b7a authored by Bryant's avatar Bryant

Altered build procedure for speech synthesis.

Speech synthesis support can now be disabled (DEFINES+=DISABLE_SPEECH)
Speech synthesis dependencies are now checked before enabling.
When support cannot be enabled, the user is now notified.
parent 1de1547b
......@@ -505,15 +505,38 @@ WindowsBuild {
-lSDL
}
#
# Festival Lite speech synthesis engine
##
# Speech synthesis library support.
# Can be forcibly disabled by adding a `DEFINES+=DISABLE_SPEECH` argument to qmake.
#
# Festival Lite speech synthesis engine
LinuxBuild {
LIBS += \
-lflite_cmu_us_kal \
-lflite_usenglish \
-lflite_cmulex \
-lflite
contains (DEFINES, DISABLE_SPEECH) {
message("Skipping support for speech synthesis (manual override)")
} else:exists(/usr/include/flite) | exists(/usr/local/include/flite) {
message(Enabling support for speech output)
LIBS += \
-lflite_cmu_us_kal \
-lflite_usenglish \
-lflite_cmulex \
-lflite
} else {
DEFINES += DISABLE_SPEECH
warning("Skipping support for speech synthesis (missing flite libraries, see README)")
}
}
# Mac support for speech synthesis is currently broken.
# Library support is built into Mac OS X
MacBuild {
message("Including support for speech synthesis.")
}
# Windows support for speech synthesis is currently broken
# Library support is built into Windows
WindowsBuild {
DEFINES += DISABLE_SPEECH
message("Skipping support for speech synthesis (unsupported on Windows)")
}
......@@ -20,8 +20,11 @@ Please make sure to delete your build folder before re-building. Independent of
build system you use (this is not related to Qt or your OS) the dependency checking and
cleaning is based on the current project revision. So if you change the project and don't remove the build folder before your next build, incremental building can leave you with stale object files.
## Additional functionality
QGroundcontrol has functionality that is dependent on the operating system and libraries installed by the user. The following sections describe these features, their dependencies, and how to disable/alter them during the build process.
### QUpgrade
QUpgrade is a submodule (a Git feature like a sub-repository) that contains extra functionality. It is compiled in by default if it has initialized and updated. It can be disabled by specifying the DISABLE_QUPGRADE definition when calling qmake `qmake DEFINES=DISABLE_QUPGRADE`.
QUpgrade is a submodule (a Git feature like a sub-repository) that contains extra functionality. It is compiled in by default if it has initialized and updated. It can be disabled by specifying the DISABLE_QUPGRADE definition when calling qmake `qmake DEFINES=DISABLE_QUPGRADE`. Note that multiple defines can be specified like this: `qmake DEFINES="DISABLE_QUPGRADE DISABLE_SPEECH"`.
To include QUpgrade functionality run the following (only needs to be done once after cloning the qggroundcontrol git repository):
* `git submodule init`
......@@ -34,6 +37,9 @@ The MAVLink dialect compiled by default by QGC is for the ardupilotmega. This wi
The `MAVLINK_CONF` variable can also be specified at the command line as an argument to qmake to allow for easy one-off compilations: `qmake MAVLINK_CONF="sensesoar ardupilotmega"`
### Speech syntehsis
QGroundcontrol can notify the controller of information via speech synthesis on the Mac and Linux platforms. This requires the `flite` library on Linux while on Mac text-to-speech support is built in starting with OS 10.6+ (Snow Leopard). This support is enabled by default on all platforms if the dependencies are met. Disabling this functionality can be done by adding the `DISABLE_SPEECH` define when running `qmake` like: `qmake DEFINES=DISABLE_SPEECH`. Note that multiple defines can be specified like this: `qmake DEFINES="DISABLE_QUPGRADE DISABLE_SPEECH"`.
# Build on Mac OSX
To build on Mac OSX (10.6 or later):
......
......@@ -37,12 +37,12 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug>
#ifdef Q_OS_MAC
#if defined Q_OS_MAC && !defined DISABLE_SPEECH
#include <ApplicationServices/ApplicationServices.h>
#endif
// Speech synthesis is only supported with MSVC compiler
#if _MSC_VER
#if defined _MSC_VER && !defined DISABLE_SPEECH
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#include <sapi.h>
......@@ -50,14 +50,14 @@ This file is part of the QGROUNDCONTROL project
//using System.Speech.Synthesis;
#endif
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH
extern "C" {
#include <flite/flite.h>
cst_voice *register_cmu_us_kal(const char *voxdir);
};
#endif
#ifdef _MSC_VER
#if defined _MSC_VER && !defined DISABLE_SPEECH
ISpVoice *GAudioOutput::pVoice = NULL;
#endif
......@@ -96,11 +96,11 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
muted = settings.value(QGC_GAUDIOOUTPUT_KEY + "muted", muted).toBool();
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH
flite_init();
#endif
#if _MSC_VER
#if defined _MSC_VER && !defined DISABLE_SPEECH
pVoice = NULL;
if (FAILED(::CoInitialize(NULL)))
......@@ -145,7 +145,7 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
GAudioOutput::~GAudioOutput()
{
#ifdef _MSC_VER
#if defined _MSC_VER && !defined DISABLE_SPEECH
pVoice->Release();
pVoice = NULL;
::CoUninitialize();
......@@ -182,7 +182,7 @@ bool GAudioOutput::say(QString text, int severity)
{
// Speech synthesis is only supported with MSVC compiler
#ifdef _MSC_VER
#if defined _MSC_VER && !defined DISABLE_SPEECH
/*SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SelectVoice("Microsoft Anna");
synth.SpeakText(text.toStdString().c_str());
......@@ -205,7 +205,7 @@ bool GAudioOutput::say(QString text, int severity)
}*/
#endif
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH
QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav");
......@@ -222,7 +222,7 @@ bool GAudioOutput::say(QString text, int severity)
#endif
#ifdef Q_OS_MAC
#if defined Q_OS_MAC && !defined DISABLE_SPEECH
// Slashes necessary to have the right start to the sentence
// copying data prevents SpeakString from reading additional chars
text = "\\" + text;
......@@ -339,14 +339,14 @@ void GAudioOutput::beep()
void GAudioOutput::selectFemaleVoice()
{
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH
//this->voice = register_cmu_us_slt(NULL);
#endif
}
void GAudioOutput::selectMaleVoice()
{
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH
//this->voice = register_cmu_us_rms(NULL);
#endif
}
......@@ -354,7 +354,7 @@ void GAudioOutput::selectMaleVoice()
/*
void GAudioOutput::selectNeutralVoice()
{
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH
this->voice = register_cmu_us_awb(NULL);
#endif
}*/
......@@ -362,26 +362,5 @@ void GAudioOutput::selectNeutralVoice()
QStringList GAudioOutput::listVoices(void)
{
QStringList l;
#ifdef Q_OS_LINUX2
cst_voice *voice;
const cst_val *v;
printf("Voices available: ");
for (v = flite_voice_list; v; v = val_cdr(v))
{
voice = val_voice(val_car(v));
QString s;
s.sprintf("%s", voice->name);
printf("%s", voice->name);
l.append(s);
}
printf("\n");
#endif
return l;
}
......@@ -40,7 +40,9 @@ This file is part of the PIXHAWK project
#include <AudioOutput>
#endif
#ifdef Q_OS_LINUX
#if !defined DISABLE_SPEECH
//#include <flite/flite.h>
#endif
#include <phonon/MediaObject>
#include <phonon/AudioOutput>
#endif
......@@ -50,20 +52,13 @@ This file is part of the PIXHAWK project
#endif
/* For Snow leopard and later
#ifdef Q_OS_MAC
#if defined Q_OS_MAC & !defined DISABLE_SPEECH
#include <NSSpeechSynthesizer.h>
#endif
*/
#ifdef Q_OS_LINUX2
extern "C" {
cst_voice *REGISTER_VOX(const char *voxdir);
void UNREGISTER_VOX(cst_voice *vox);
cst_voice *register_cmu_us_kal16(const char *voxdir);
}
#endif
#if _MSC_VER
#if defined _MSC_VER && !defined DISABLE_SPEECH
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#include <sapi.h>
#endif
......@@ -116,13 +111,13 @@ signals:
void mutedChanged(bool);
protected:
#ifdef Q_OS_MAC
#if defined Q_OS_MAC && !defined DISABLE_SPEECH
//NSSpeechSynthesizer
#endif
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX && !defined DISABLE_SPEECH
//cst_voice* voice; ///< The flite voice object
#endif
#ifdef _MSC_VER
#if defined _MSC_VER && !defined DISABLE_SPEECH
static ISpVoice *pVoice;
#endif
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