Commit 0528d871 authored by lm's avatar lm

Quick fix for flite in linux

parent 146474c9
......@@ -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
......
......@@ -47,21 +47,23 @@ using System;
using System.Speech.Synthesis;
#endif
#ifdef Q_OS_LINUX
extern "C" {
#include <flite.h>
#include <cmu_us_awb/voxdefs.h>
//#ifdef Q_OS_LINUX
//extern "C" {
//#include <flite/flite.h>
//#include <cmu_us_awb/voxdefs.h>
//#include <cmu_us_slt/voxdefs.h>
//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;
......
......@@ -39,7 +39,7 @@ This file is part of the PIXHAWK project
#include <Phonon>
#endif
#ifdef Q_OS_LINUX
#include <flite.h>
#include <flite/flite.h>
#include <phonon>
#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
......
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