Commit 2291af59 authored by Hugo Vincent's avatar Hugo Vincent

Switched from flite for speech on the Mac to built-in MacOSX speech...

Switched from flite for speech on the Mac to built-in MacOSX speech synthesizer. Fixed build system for 64-bit builds (using official SDL.framework, and Qt frameworks). 
parent 8486386a
*Makefile*
./build
build
Info.plist
obj
*.log
......@@ -16,3 +16,5 @@ qrc_*.cpp
tmp
debug
release
opengroundcontrol.xcodeproj/**
[submodule "MAVLink"]
path = MAVLink
url = git://github.com/pixhawk/mavlink.git
Subproject commit 92e5a9f5d7deafebe8f19f5f1462995f77cce300
......@@ -61,25 +61,19 @@ macx {
message(Building for Mac OS X)
QT += phonon
CONFIG += x86_64 cocoa
CONFIG -= static
DESTDIR = $$BASEDIR/bin/mac
INCLUDEPATH += /opt/local/include/boost \
/opt/local/include/SDL
INCLUDEPATH += -framework SDL \
/Users/hugo/Projects/PixHawkGroundControl/MAVLink/src
LIBS += -framework IOKit \
-L/opt/local/lib \
-L$$BASEDIR/lib/flite/mac32 \
-lm \
-lflite_cmu_us_awb \
-lflite_cmu_us_rms \
-lflite_cmu_us_slt \
-lflite_usenglish \
-lflite_cmulex \
-lflite \
-L/opt/local/lib/SDL \
-lSDL \
-lSDLmain
-framework SDL \
-framework CoreFoundation \
-framework ApplicationServices \
-lm
DEFINES += _TTY_POSIX_
#ICON = $$BASEDIR/img/icons/empty.png
......
......@@ -99,13 +99,7 @@ HEADERS += src/MG.h \
src/ui/MAVLinkSettingsWidget.h \
src/ui/AudioOutputWidget.h \
src/AudioOutput.h \
src/LogCompressor.h \
src/comm/ViconTarsusProtocol.h \
src/comm/TarsusField.h \
src/comm/TarsusFieldDescriptor.h \
src/comm/TarsusFieldTriplet.h \
src/comm/TarsusRigidBody.h \
src/comm/TarsusStream.h
src/LogCompressor.h
SOURCES += src/main.cc \
src/Core.cc \
src/uas/UASManager.cc \
......@@ -150,6 +144,5 @@ SOURCES += src/main.cc \
src/ui/MAVLinkSettingsWidget.cc \
src/ui/AudioOutputWidget.cc \
src/AudioOutput.cc \
src/LogCompressor.cc \
src/comm/ViconTarsusProtocol.cc
src/LogCompressor.cc
RESOURCES = mavground.qrc
#include "AudioOutput.h"
#include <flite.h>
#include <phonon/mediaobject.h>
#include <QTemporaryFile>
#ifndef Q_OS_MAC
#include <flite.h>
#include <phonon/mediaobject.h>
#include <QTemporaryFile>
#else
#include <ApplicationServices/ApplicationServices.h>
#endif
#include <QDebug>
#ifndef Q_OS_MAC
extern "C" {
#include <cmu_us_awb/voxdefs.h>
//#include <cmu_us_slt/voxdefs.h>
......@@ -18,12 +23,13 @@ extern "C" {
cst_voice *register_cmu_us_rms(const char *voxdir);
void unregister_cmu_us_rms(cst_voice *vox);
};
#endif
AudioOutput::AudioOutput(QString voice, QObject* parent) : QObject(parent),
voice(NULL),
voiceIndex(0)
{
#ifndef _WIN32
#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
flite_init();
#endif
......@@ -63,7 +69,12 @@ voiceIndex(0)
bool AudioOutput::say(QString text, int severity)
{
// Only give speech output on Linux and MacOS
#ifndef _WIN32
#if defined(Q_OS_WIN32)
qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!";
#elif defined(Q_OS_MAC)
SpeakString((const unsigned char*)text.toAscii().data());
qDebug() << "Synthesized: " << text;
#else
QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav");
if (file.open())
......@@ -77,8 +88,6 @@ bool AudioOutput::say(QString text, int severity)
music->play();
qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str();
}
#else
qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!";
#endif
return true;
}
......@@ -103,14 +112,14 @@ bool AudioOutput::stopEmergency()
void AudioOutput::selectFemaleVoice()
{
#ifndef _WIN32
#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
this->voice = register_cmu_us_slt(NULL);
#endif
}
void AudioOutput::selectMaleVoice()
{
#ifndef _WIN32
#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
this->voice = register_cmu_us_rms(NULL);
#endif
}
......@@ -118,7 +127,7 @@ void AudioOutput::selectMaleVoice()
void AudioOutput::selectNeutralVoice()
{
#ifndef _WIN32
#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
this->voice = register_cmu_us_awb(NULL);
#endif
}
......@@ -134,7 +143,7 @@ extern "C" {
const cst_val *v;
QStringList l;
#ifndef _WIN32
#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
/*
printf("Voices available: ");
for (v=flite_voice_list; v; v=val_cdr(v))
......
......@@ -69,7 +69,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv)
QFontDatabase fontDatabase = QFontDatabase();
const QString fontFileName = ":/general/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app
const QString fontFamilyName = "Bitstream Vera Sans";
if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!", fontFileName);
if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toAscii().data());
fontDatabase.addApplicationFont(fontFileName);
setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
......@@ -90,9 +90,6 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv)
AudioOutput* audio = new AudioOutput();
audio->say("Ground Control Station started", 1);
tarsus = new ViconTarsusProtocol();
tarsus->start();
// Start the user interface
splashScreen->showMessage(tr("Starting User Interface"));
startUI();
......
......@@ -38,7 +38,6 @@ This file is part of the PIXHAWK project
#include "MainWindow.h"
#include "UASManager.h"
#include "LinkManager.h"
#include "ViconTarsusProtocol.h"
/**
* @brief The main application and management class.
......@@ -69,8 +68,6 @@ protected:
private:
MGMainWindow* mainWindow;
ViconTarsusProtocol* tarsus;
};
#endif // _MGCORE_H_
......@@ -35,7 +35,7 @@ This file is part of the PIXHAWK project
#include <QThread>
#include <QList>
#include <SDL.h>
#include <SDL/SDL.h>
#include "UASInterface.h"
......
......@@ -33,6 +33,11 @@ This file is part of the PIXHAWK project
#include "MainWindow.h"
#include "configuration.h"
/* SDL does ugly things to main() */
#ifdef main
# undef main
#endif
/**
* @brief Starts the application
*
......
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