Commit 87338236 authored by Thomas Gubler's avatar Thomas Gubler

espeak: cleanup

parent eb3f48b9
......@@ -26,6 +26,7 @@ This file is part of the QGROUNDCONTROL project
* @brief Implementation of audio output
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Thomas Gubler <thomasgubler@gmail.com>
*
*/
......@@ -53,12 +54,6 @@ This file is part of the QGROUNDCONTROL project
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
// Using eSpeak for speech synthesis: following https://github.com/mondhs/espeak-sample/blob/master/sampleSpeak.cpp
#include <espeak/speak_lib.h>
espeak_POSITION_TYPE espeak_position_type;
espeak_AUDIO_OUTPUT espeak_output = AUDIO_OUTPUT_PLAYBACK;
int espeak_buflength = 500;
int espeak_options = 0;
char *espeak_path = NULL;
unsigned int espeak_flags=espeakCHARS_AUTO;
#endif
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
......@@ -101,18 +96,13 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
espeak_Initialize(espeak_output, espeak_buflength, espeak_path, espeak_options );
const char *espeak_langNativeString = "en-uk"; //Default to US English
espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 500, NULL, 0); // initialize for playback with 500ms buffer and no options (see speak_lib.h)
espeak_VOICE espeak_voice;
memset(&espeak_voice, 0, sizeof(espeak_VOICE)); // Zero out the voice first
espeak_voice.languages = espeak_langNativeString;
espeak_voice.name = "klatt";
espeak_voice.variant = 0;
espeak_voice.gender = 2;
espeak_voice.languages = "en-uk"; // Default to British English
espeak_voice.name = "klatt"; // espeak voice name
espeak_voice.gender = 2; // Female
espeak_SetVoiceByProperties(&espeak_voice);
// Rate of eSpeak can be changed if needed:
// espeak_PARAMETER rateParam = espeakRATE;
// espeak_SetParameter(rateParam , 150, 0);
#endif
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
......@@ -221,13 +211,8 @@ bool GAudioOutput::say(QString text, int severity)
#endif
#if defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED
unsigned int espeak_size, espeak_position = 0, espeak_end_position = 0, *espeak_unique_identifier = NULL;
void* espeak_user_data = NULL;
espeak_size = strlen(text.toStdString().c_str());
// qDebug() << "eSpeak: Saying " << text;
espeak_Synth( text.toStdString().c_str(), espeak_size, espeak_position, espeak_position_type, espeak_end_position, espeak_flags,
espeak_unique_identifier, espeak_user_data );
// qDebug() << "Done talking " << text;
unsigned int espeak_size = strlen(text.toStdString().c_str());
espeak_Synth(text.toStdString().c_str(), espeak_size, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, NULL); // see the documentation in speak_lib.h for the description of the arguments
#endif
#if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED
......
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