diff --git a/.gitignore b/.gitignore index a2a99d8382019c1ebd959422d7c1c04a81ba6e05..d377e9bb27fe65e10ff69a44255ade244ffbdbd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ *Makefile* -./build +build Info.plist obj *.log @@ -16,3 +16,5 @@ qrc_*.cpp tmp debug release +opengroundcontrol.xcodeproj/** + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..aab53d9259254c68027a3f0e6b43c3d752e9594a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "MAVLink"] + path = MAVLink + url = git://github.com/pixhawk/mavlink.git diff --git a/lib/flite/mac32/libflite.a b/lib/flite/mac32/libflite.a deleted file mode 100644 index 96c0483be430892732c34f1a6fc250130fb4d323..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_cmu_time_awb.a b/lib/flite/mac32/libflite_cmu_time_awb.a deleted file mode 100644 index d31668dbe086ac5e1ae5f262f354c9e67dedba5e..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_cmu_time_awb.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_cmu_us_awb.a b/lib/flite/mac32/libflite_cmu_us_awb.a deleted file mode 100644 index d06d818f1364d966e2c539c147bc76e1fa5195f3..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_cmu_us_awb.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_cmu_us_kal.a b/lib/flite/mac32/libflite_cmu_us_kal.a deleted file mode 100644 index c57fc96b70d0f2a4c96264204ea376e89c60f0b3..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_cmu_us_kal.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_cmu_us_kal16.a b/lib/flite/mac32/libflite_cmu_us_kal16.a deleted file mode 100644 index bb005e5a7debb0e730ef8a01e84ae4016f98c275..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_cmu_us_kal16.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_cmu_us_rms.a b/lib/flite/mac32/libflite_cmu_us_rms.a deleted file mode 100644 index f3bf17fa364773894a43998b9f467704bda5ee22..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_cmu_us_rms.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_cmu_us_slt.a b/lib/flite/mac32/libflite_cmu_us_slt.a deleted file mode 100644 index 019486705162929bb5dbaca6d8ddeedfa0929fea..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_cmu_us_slt.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_cmulex.a b/lib/flite/mac32/libflite_cmulex.a deleted file mode 100644 index 9e727eebf94c9e07b09405714e22211f1f7d1f49..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_cmulex.a and /dev/null differ diff --git a/lib/flite/mac32/libflite_usenglish.a b/lib/flite/mac32/libflite_usenglish.a deleted file mode 100644 index ff77da82a144fd13978a55682b146f5ff1531331..0000000000000000000000000000000000000000 Binary files a/lib/flite/mac32/libflite_usenglish.a and /dev/null differ diff --git a/mavground.pri b/mavground.pri index 13a97bc9cf2fce316903833e2de64f75cdc4541d..34e261000ed1358fe87ed3a5afd45f6bc727cbba 100644 --- a/mavground.pri +++ b/mavground.pri @@ -25,7 +25,7 @@ # #------------------------------------------------- -QT += network opengl svg xml +QT += network opengl svg xml phonon TEMPLATE = app TARGET = opengroundcontrol @@ -62,23 +62,23 @@ macx { message(Building for Mac OS X) - QT += phonon - + CONFIG += x86 + + contains ( DEFINES, QT_MAC_USE_COCOA ) { + CONFIG += x86_64 cocoa + CONFIG -= static + } + DESTDIR = $$BASEDIR/bin/mac - + + INCLUDEPATH += -framework SDL + 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/lib/mac32/SDL \ - -lSDL \ - -lSDLmain + -framework SDL \ + -framework CoreFoundation \ + -framework ApplicationServices \ + -lm + DEFINES += _TTY_POSIX_ #ICON = $$BASEDIR/img/icons/empty.png @@ -88,8 +88,6 @@ macx { linux-g++ { message(Building for GNU/Linux) - - QT += phonon debug { DESTDIR = $$BASEDIR @@ -99,10 +97,6 @@ linux-g++ { DESTDIR = $$BASEDIR } INCLUDEPATH += /usr/include/SDL - # /usr/include/qwt-qt4 - - #-L$$BASEDIR/lib/qwt/linux \ - DEFINES += _TTY_POSIX_ @@ -137,26 +131,18 @@ linux-g++ { } -# Windows (32bit) +# Windows (32bit/64bit) win32 { message(Building for Windows Platform (32/64bit)) # Special settings for debug - #CONFIG += CONSOLE + #CONFIG += CONSOLE LIBS += -L$$BASEDIR\lib\sdl\win32 \ -lmingw32 -lSDLmain -lSDL -mwindows INCLUDEPATH += $$BASEDIR/lib/sdl/include/SDL - #LIBS += -L$$BASEDIR\lib\qextserialport\win32 \ - # -lqextserialport \ - # -lsetupapi - # -L$$BASEDIR/lib/openjaus/libjaus/lib/win32 \ - # -ljaus \ - # -L$$BASEDIR/lib/openjaus/libopenJaus/lib/win32 \ - # -lopenjaus - DEFINES += _TTY_WIN_ debug { diff --git a/mavground.pro b/mavground.pro index d7cfd67d5a299c095fa405cdf469014cc0e7f58a..e474ae2429a00cf309cd853d793a0a494a7e9eec 100644 --- a/mavground.pro +++ b/mavground.pro @@ -8,7 +8,8 @@ include(src/lib/qextserialport/qextserialport.pri) include(src/lib/qwt/qwt.pri) # Include FLITE audio synthesizer library -# include(src/lib/flite/flite.pri) +#include(src/lib/flite/flite.pri) + # Include QMapControl map library include(lib/QMapControl/QMapControl.pri) DEPENDPATH += . \ @@ -17,8 +18,8 @@ DEPENDPATH += . \ INCLUDEPATH += . \ lib/QMapControl \ ../mavlink/src \ - mavlink/src \ - src/mavlink + MAVLink/src \ + mavlink/src # Input FORMS += src/ui/MainWindow.ui \ diff --git a/src/AudioOutput.cc b/src/AudioOutput.cc new file mode 100644 index 0000000000000000000000000000000000000000..7f0630b1a889e181163569f374a512ea0cb7cf96 --- /dev/null +++ b/src/AudioOutput.cc @@ -0,0 +1,165 @@ +#include "AudioOutput.h" + +#ifndef Q_OS_MAC + #include + #include + #include +#else + #include +#endif + +#include + +#ifndef Q_OS_MAC +extern "C" { +#include + //#include + //cst_voice *REGISTER_VOX(const char *voxdir); + //void UNREGISTER_VOX(cst_voice *vox); + cst_voice *register_cmu_us_awb(const char *voxdir); + void unregister_cmu_us_awb(cst_voice *vox); + cst_voice *register_cmu_us_slt(const char *voxdir); + void unregister_cmu_us_slt(cst_voice *vox); + 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) +{ +#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) + flite_init(); +#endif + + switch (voiceIndex) + { + case 0: + selectFemaleVoice(); + break; + case 1: + selectMaleVoice(); + break; + default: + selectNeutralVoice(); + break; + } + + /* + // List available voices + QStringList voices = listVoices(); + foreach (QString s, voices) + { + qDebug() << "VOICE: " << s; + } + + if (voice.length() > 0) + { + //this->voice = flite_voice_select(voice.toStdString().c_str()); + } + else + { + // Take default voice + //this->voice = flite_voice_select("awb"); + } + */ +} + +bool AudioOutput::say(QString text, int severity) +{ + // Only give speech output on Linux and MacOS +#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()) + { + cst_wave* wav = flite_text_to_wave(text.toStdString().c_str(), this->voice); + // file.fileName() returns the unique file name + cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff"); + Phonon::MediaObject *music = + Phonon::createPlayer(Phonon::MusicCategory, + Phonon::MediaSource(file.fileName().toStdString().c_str())); + music->play(); + qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str(); + } +#endif + return true; +} + +bool AudioOutput::alert(QString text) +{ + // Play alert sound + + // Say alert message + return say(text, 2); +} + +bool AudioOutput::startEmergency() +{ + return false; +} + +bool AudioOutput::stopEmergency() +{ + return false; +} + +void AudioOutput::selectFemaleVoice() +{ +#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) + this->voice = register_cmu_us_slt(NULL); +#endif +} + +void AudioOutput::selectMaleVoice() +{ +#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) + this->voice = register_cmu_us_rms(NULL); +#endif +} + + +void AudioOutput::selectNeutralVoice() +{ +#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) + this->voice = register_cmu_us_awb(NULL); +#endif +} + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + QStringList AudioOutput::listVoices(void) + { + + + cst_voice *voice; + const cst_val *v; + QStringList l; + +#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) + /* + 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; + + } +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/src/Core.h b/src/Core.h index 49d81b7bf093112c8ae20f5ba6c0f199b93bd553..857cb0371cd6e825c94e2780b91bf9485cab9610 100644 --- a/src/Core.h +++ b/src/Core.h @@ -70,7 +70,6 @@ protected: private: MainWindow* mainWindow; //ViconTarsusProtocol* tarsus; - }; #endif /* _CORE_H_ */ diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index ece5b3e290fca7e680d68ab795cfbb2e80ae1c04..6f17bfc7bfff0344cb5ae1447aa5779b45ba3d53 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -32,13 +32,19 @@ This file is part of the PIXHAWK project #include #include "GAudioOutput.h" #include "MG.h" -#include +#ifdef Q_OS_MAC +#include +#endif +#ifdef Q_OS_LINUX +#include +#endif #include #include #include +#ifndef Q_OS_MAC extern "C" { #include //#include @@ -51,6 +57,7 @@ extern "C" { cst_voice *register_cmu_us_rms(const char *voxdir); void unregister_cmu_us_rms(cst_voice *vox); }; +#endif /** * This class follows the singleton design pattern @@ -76,14 +83,14 @@ voice(NULL), voiceIndex(0), emergency(false) { -#ifndef _WIN32 +#if Q_OS_LINUX flite_init(); +#endif m_media = new Phonon::MediaObject(this); Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); createPath(m_media, audioOutput); emergencyTimer = new QTimer(); connect(emergencyTimer, SIGNAL(timeout()), this, SLOT(beep())); -#endif switch (voiceIndex) { @@ -97,27 +104,6 @@ emergency(false) selectNeutralVoice(); break; } - - /* - // List available voices - QStringList voices = listVoices(); - foreach (QString s, voices) - { - qDebug() << "VOICE: " << s; - } - - if (voice.length() > 0) - { - //this->voice = flite_voice_select(voice.toStdString().c_str()); - } - else - { - // Take default voice - //this->voice = flite_voice_select("awb"); - } - */ - - } bool GAudioOutput::say(QString text, int severity) @@ -126,7 +112,7 @@ bool GAudioOutput::say(QString text, int severity) if (!emergency) { // Only give speech output on Linux and MacOS -#ifndef _WIN32 +#ifdef Q_OS_LINUX QTemporaryFile file; file.setFileTemplate("XXXXXX.wav"); if (file.open()) @@ -140,7 +126,20 @@ bool GAudioOutput::say(QString text, int severity) qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str(); res = true; } -#else +#endif + +#ifdef Q_OS_MAC + // Slashes necessary to have the right start to the sentence + // copying data prevents SpeakString from reading additional chars + text = "\\" + text; + QStdWString str = text.toStdWString(); + unsigned char str2[1024] = {}; + memcpy(str2, text.toAscii().data(), str.length()); + SpeakString(str2); + qDebug() << "Synthesized: " << text.toAscii(); +#endif + +#ifdef Q_OS_WIN32 qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!"; #endif } @@ -212,14 +211,14 @@ void GAudioOutput::beep() void GAudioOutput::selectFemaleVoice() { -#ifndef _WIN32 +#ifdef Q_OS_LINUX this->voice = register_cmu_us_slt(NULL); #endif } void GAudioOutput::selectMaleVoice() { -#ifndef _WIN32 +#ifdef Q_OS_LINUX this->voice = register_cmu_us_rms(NULL); #endif } @@ -227,7 +226,7 @@ void GAudioOutput::selectMaleVoice() void GAudioOutput::selectNeutralVoice() { -#ifndef _WIN32 +#ifdef Q_OS_LINUX this->voice = register_cmu_us_awb(NULL); #endif } diff --git a/src/GAudioOutput.h b/src/GAudioOutput.h index 8b6c76df38a78464d37735c6ffa8388f360e301c..4e20274d2b5f8705367f43d84114756423f7ea9f 100644 --- a/src/GAudioOutput.h +++ b/src/GAudioOutput.h @@ -38,6 +38,12 @@ This file is part of the PIXHAWK project #include #include +/* For Snow leopard and later +#ifdef Q_OS_MAC +#include +#endif + */ + /** * @brief Audio Output (speech synthesizer and "beep" output) * This class follows the singleton design pattern @@ -71,6 +77,9 @@ public slots: void beep(); protected: + #ifdef Q_OS_MAC + //NSSpeechSynthesizer +#endif cst_voice* voice; ///< The flite voice object int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms) Phonon::MediaObject* m_media; ///< The output object for audio diff --git a/src/input/JoystickInput.h b/src/input/JoystickInput.h index b4b44689dcf725d1bd5858b1f77c4f94883851fb..14ee34cb47674a59b6de2a4cf4bea194c571e34f 100644 --- a/src/input/JoystickInput.h +++ b/src/input/JoystickInput.h @@ -35,7 +35,7 @@ This file is part of the PIXHAWK project #include #include -#include +#include #include "UASInterface.h" diff --git a/src/main.cc b/src/main.cc index 8e024161f72814ae5815aaad6fc5fa17c38001f4..0c65955b3b9b500a06830a83c452ba9ac32efa7b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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 * diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index de666717ef05815010fbda685a3fb3ee37b9b446..b03e547383f070590ef75984341f207ad2c1a070 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -130,7 +130,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) this->status = state.status; getStatusForCode((int)state.status, uasState, stateDescription); emit statusChanged(this, uasState, stateDescription); - stateAudio = "changed status to " + uasState; + stateAudio = " changed status to " + uasState; } if (static_cast(this->mode) != static_cast(state.mode))