From 0528d8713e6c79f5838f084ac17decc19018ab38 Mon Sep 17 00:00:00 2001 From: lm Date: Thu, 29 Apr 2010 17:14:27 +0200 Subject: [PATCH] Quick fix for flite in linux --- qgroundcontrol.pri | 17 +++++++++-------- src/GAudioOutput.cc | 35 +++++++++++++++++++---------------- src/GAudioOutput.h | 12 ++++++++++-- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index aae25e1b6..927072e12 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -97,27 +97,28 @@ linux-g++ { DESTDIR = $$BASEDIR } INCLUDEPATH += /usr/include \ - $$BASEDIR/lib/flite/include \ - $$BASEDIR/lib/flite/lang + # $$BASEDIR/lib/flite/include \ + # $$BASEDIR/lib/flite/lang HARDWARE_PLATFORM = $$system(uname -a) contains( HARDWARE_PLATFORM, x86_64 ) { # 64-bit Linux - LIBS += \ - -L$$BASEDIR/lib/flite/linux64 + #LIBS += \ + #-L$$BASEDIR/lib/flite/linux64 message(Building for GNU/Linux 64bit/x64) } else { # 32-bit Linux - LIBS += \ - -L$$BASEDIR/lib/flite/linux32 + #LIBS += \ + #-L$$BASEDIR/lib/flite/linux32 message(Building for GNU/Linux 32bit/i386) } LIBS += -lm \ - -lflite_cmu_us_rms \ - -lflite_cmu_us_slt \ + #-lflite_cmu_us_rms \ + #-lflite_cmu_us_slt \ -lflite_usenglish \ -lflite_cmulex \ + -lflite_cmu_us_kal16 \ -lflite \ -lSDL \ -lSDLmain diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 384066afd..0fb7fa821 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -47,21 +47,23 @@ using System; using System.Speech.Synthesis; #endif -#ifdef Q_OS_LINUX -extern "C" { -#include -#include +//#ifdef Q_OS_LINUX +//extern "C" { +//#include +//#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 + //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 + + /** * This class follows the singleton design pattern @@ -84,7 +86,7 @@ GAudioOutput* GAudioOutput::instance() GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent), #ifdef Q_OS_LINUX -voice(NULL), +//voice(NULL), #endif voiceIndex(0), emergency(false) @@ -125,12 +127,13 @@ bool GAudioOutput::say(QString text, int severity) synth.SpeakText("Hello, world!"); #endif -#ifdef Q_OS_LINUX +#ifdef Q_OS_LINUX2 QTemporaryFile file; file.setFileTemplate("XXXXXX.wav"); if (file.open()) { - cst_wave* wav = flite_text_to_wave(text.toStdString().c_str(), this->voice); + cst_voice* v = register_cmu_us_kal16(NULL); + cst_wave* wav = flite_text_to_wave(text.toStdString().c_str(), v); // file.fileName() returns the unique file name cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff"); m_media->setCurrentSource(Phonon::MediaSource(file.fileName().toStdString().c_str())); @@ -236,14 +239,14 @@ void GAudioOutput::beep() void GAudioOutput::selectFemaleVoice() { #ifdef Q_OS_LINUX - this->voice = register_cmu_us_slt(NULL); + //this->voice = register_cmu_us_slt(NULL); #endif } void GAudioOutput::selectMaleVoice() { #ifdef Q_OS_LINUX - this->voice = register_cmu_us_rms(NULL); + //this->voice = register_cmu_us_rms(NULL); #endif } @@ -258,7 +261,7 @@ void GAudioOutput::selectNeutralVoice() QStringList GAudioOutput::listVoices(void) { QStringList l; -#ifdef Q_OS_LINUX +#ifdef Q_OS_LINUX2 cst_voice *voice; const cst_val *v; diff --git a/src/GAudioOutput.h b/src/GAudioOutput.h index 7e6c6cc78..896a01661 100644 --- a/src/GAudioOutput.h +++ b/src/GAudioOutput.h @@ -39,7 +39,7 @@ This file is part of the PIXHAWK project #include #endif #ifdef Q_OS_LINUX -#include +#include #include #endif #ifdef Q_OS_WIN @@ -52,6 +52,14 @@ This file is part of the PIXHAWK project #endif */ +#ifdef Q_OS_LINUX +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 + /** * @brief Audio Output (speech synthesizer and "beep" output) * This class follows the singleton design pattern @@ -93,7 +101,7 @@ protected: //NSSpeechSynthesizer #endif #ifdef Q_OS_LINUX - cst_voice* voice; ///< The flite voice object + //cst_voice* voice; ///< The flite voice object #endif int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms) Phonon::MediaObject* m_media; ///< The output object for audio -- 2.22.0