Commit 0528d871 authored by lm's avatar lm
Browse files

Quick fix for flite in linux

parent 146474c9
...@@ -97,27 +97,28 @@ linux-g++ { ...@@ -97,27 +97,28 @@ linux-g++ {
DESTDIR = $$BASEDIR DESTDIR = $$BASEDIR
} }
INCLUDEPATH += /usr/include \ INCLUDEPATH += /usr/include \
$$BASEDIR/lib/flite/include \ # $$BASEDIR/lib/flite/include \
$$BASEDIR/lib/flite/lang # $$BASEDIR/lib/flite/lang
HARDWARE_PLATFORM = $$system(uname -a) HARDWARE_PLATFORM = $$system(uname -a)
contains( HARDWARE_PLATFORM, x86_64 ) { contains( HARDWARE_PLATFORM, x86_64 ) {
# 64-bit Linux # 64-bit Linux
LIBS += \ #LIBS += \
-L$$BASEDIR/lib/flite/linux64 #-L$$BASEDIR/lib/flite/linux64
message(Building for GNU/Linux 64bit/x64) message(Building for GNU/Linux 64bit/x64)
} else { } else {
# 32-bit Linux # 32-bit Linux
LIBS += \ #LIBS += \
-L$$BASEDIR/lib/flite/linux32 #-L$$BASEDIR/lib/flite/linux32
message(Building for GNU/Linux 32bit/i386) message(Building for GNU/Linux 32bit/i386)
} }
LIBS += -lm \ LIBS += -lm \
-lflite_cmu_us_rms \ #-lflite_cmu_us_rms \
-lflite_cmu_us_slt \ #-lflite_cmu_us_slt \
-lflite_usenglish \ -lflite_usenglish \
-lflite_cmulex \ -lflite_cmulex \
-lflite_cmu_us_kal16 \
-lflite \ -lflite \
-lSDL \ -lSDL \
-lSDLmain -lSDLmain
......
...@@ -47,21 +47,23 @@ using System; ...@@ -47,21 +47,23 @@ using System;
using System.Speech.Synthesis; using System.Speech.Synthesis;
#endif #endif
#ifdef Q_OS_LINUX //#ifdef Q_OS_LINUX
extern "C" { //extern "C" {
#include <flite.h> //#include <flite/flite.h>
#include <cmu_us_awb/voxdefs.h> //#include <cmu_us_awb/voxdefs.h>
//#include <cmu_us_slt/voxdefs.h> //#include <cmu_us_slt/voxdefs.h>
//cst_voice *REGISTER_VOX(const char *voxdir); //cst_voice *REGISTER_VOX(const char *voxdir);
//void UNREGISTER_VOX(cst_voice *vox); //void UNREGISTER_VOX(cst_voice *vox);
//cst_voice *register_cmu_us_awb(const char *voxdir); //cst_voice *register_cmu_us_awb(const char *voxdir);
//void unregister_cmu_us_awb(cst_voice *vox); //void unregister_cmu_us_awb(cst_voice *vox);
cst_voice *register_cmu_us_slt(const char *voxdir); //cst_voice *register_cmu_us_slt(const char *voxdir);
void unregister_cmu_us_slt(cst_voice *vox); //void unregister_cmu_us_slt(cst_voice *vox);
cst_voice *register_cmu_us_rms(const char *voxdir); //cst_voice *register_cmu_us_rms(const char *voxdir);
void unregister_cmu_us_rms(cst_voice *vox); //void unregister_cmu_us_rms(cst_voice *vox);
}; //};
#endif //#endif
/** /**
* This class follows the singleton design pattern * This class follows the singleton design pattern
...@@ -84,7 +86,7 @@ GAudioOutput* GAudioOutput::instance() ...@@ -84,7 +86,7 @@ GAudioOutput* GAudioOutput::instance()
GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent), GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent),
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
voice(NULL), //voice(NULL),
#endif #endif
voiceIndex(0), voiceIndex(0),
emergency(false) emergency(false)
...@@ -125,12 +127,13 @@ bool GAudioOutput::say(QString text, int severity) ...@@ -125,12 +127,13 @@ bool GAudioOutput::say(QString text, int severity)
synth.SpeakText("Hello, world!"); synth.SpeakText("Hello, world!");
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX2
QTemporaryFile file; QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav"); file.setFileTemplate("XXXXXX.wav");
if (file.open()) 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 // file.fileName() returns the unique file name
cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff"); cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff");
m_media->setCurrentSource(Phonon::MediaSource(file.fileName().toStdString().c_str())); m_media->setCurrentSource(Phonon::MediaSource(file.fileName().toStdString().c_str()));
...@@ -236,14 +239,14 @@ void GAudioOutput::beep() ...@@ -236,14 +239,14 @@ void GAudioOutput::beep()
void GAudioOutput::selectFemaleVoice() void GAudioOutput::selectFemaleVoice()
{ {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
this->voice = register_cmu_us_slt(NULL); //this->voice = register_cmu_us_slt(NULL);
#endif #endif
} }
void GAudioOutput::selectMaleVoice() void GAudioOutput::selectMaleVoice()
{ {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
this->voice = register_cmu_us_rms(NULL); //this->voice = register_cmu_us_rms(NULL);
#endif #endif
} }
...@@ -258,7 +261,7 @@ void GAudioOutput::selectNeutralVoice() ...@@ -258,7 +261,7 @@ void GAudioOutput::selectNeutralVoice()
QStringList GAudioOutput::listVoices(void) QStringList GAudioOutput::listVoices(void)
{ {
QStringList l; QStringList l;
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX2
cst_voice *voice; cst_voice *voice;
const cst_val *v; const cst_val *v;
......
...@@ -39,7 +39,7 @@ This file is part of the PIXHAWK project ...@@ -39,7 +39,7 @@ This file is part of the PIXHAWK project
#include <Phonon> #include <Phonon>
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include <flite.h> #include <flite/flite.h>
#include <phonon> #include <phonon>
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
...@@ -52,6 +52,14 @@ This file is part of the PIXHAWK project ...@@ -52,6 +52,14 @@ This file is part of the PIXHAWK project
#endif #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) * @brief Audio Output (speech synthesizer and "beep" output)
* This class follows the singleton design pattern * This class follows the singleton design pattern
...@@ -93,7 +101,7 @@ protected: ...@@ -93,7 +101,7 @@ protected:
//NSSpeechSynthesizer //NSSpeechSynthesizer
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
cst_voice* voice; ///< The flite voice object //cst_voice* voice; ///< The flite voice object
#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)
Phonon::MediaObject* m_media; ///< The output object for audio Phonon::MediaObject* m_media; ///< The output object for audio
......
Supports Markdown
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