|
|
@ -48,13 +48,13 @@ using System.Speech.Synthesis; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
extern "C" { |
|
|
|
extern "C" { |
|
|
|
#include <flite.h> |
|
|
|
#include <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); |
|
|
@ -91,9 +91,12 @@ emergency(false) |
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
flite_init(); |
|
|
|
flite_init(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
// Initialize audio output
|
|
|
|
m_media = new Phonon::MediaObject(this); |
|
|
|
m_media = new Phonon::MediaObject(this); |
|
|
|
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); |
|
|
|
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); |
|
|
|
createPath(m_media, audioOutput); |
|
|
|
createPath(m_media, audioOutput); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare regular emergency signal, will be fired off on calling startEmergency()
|
|
|
|
emergencyTimer = new QTimer(); |
|
|
|
emergencyTimer = new QTimer(); |
|
|
|
connect(emergencyTimer, SIGNAL(timeout()), this, SLOT(beep())); |
|
|
|
connect(emergencyTimer, SIGNAL(timeout()), this, SLOT(beep())); |
|
|
|
|
|
|
|
|
|
|
@ -102,11 +105,8 @@ emergency(false) |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
selectFemaleVoice(); |
|
|
|
selectFemaleVoice(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
|
|
|
|
selectMaleVoice(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
selectNeutralVoice(); |
|
|
|
selectMaleVoice(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -132,7 +132,6 @@ bool GAudioOutput::say(QString text, int severity) |
|
|
|
// 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())); |
|
|
|
qDebug() << "TYPE:" << m_media->currentSource().type(); |
|
|
|
|
|
|
|
m_media->play(); |
|
|
|
m_media->play(); |
|
|
|
qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str(); |
|
|
|
qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str(); |
|
|
|
res = true; |
|
|
|
res = true; |
|
|
@ -149,10 +148,6 @@ bool GAudioOutput::say(QString text, int severity) |
|
|
|
SpeakString(str2); |
|
|
|
SpeakString(str2); |
|
|
|
qDebug() << "Synthesized: " << text.toAscii(); |
|
|
|
qDebug() << "Synthesized: " << text.toAscii(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN32 |
|
|
|
|
|
|
|
qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!"; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return res; |
|
|
|
return res; |
|
|
|
} |
|
|
|
} |
|
|
@ -227,52 +222,46 @@ 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 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
void GAudioOutput::selectNeutralVoice() |
|
|
|
void GAudioOutput::selectNeutralVoice() |
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
//this->voice = register_cmu_us_awb(NULL);
|
|
|
|
this->voice = register_cmu_us_awb(NULL); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
QStringList GAudioOutput::listVoices(void) |
|
|
|
extern "C" { |
|
|
|
{ |
|
|
|
#endif /* __cplusplus */ |
|
|
|
QStringList l; |
|
|
|
QStringList GAudioOutput::listVoices(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QStringList l; |
|
|
|
|
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
#ifdef Q_OS_LINUX |
|
|
|
cst_voice *voice; |
|
|
|
cst_voice *voice; |
|
|
|
const cst_val *v; |
|
|
|
const cst_val *v; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef __cplusplus |
|
|
|
printf("\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
return l; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif /* __cplusplus */ |
|
|
|
|
|
|
|