From 873382366c92128bd3f4b7dcbc6926846349bd8a Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Mon, 24 Feb 2014 22:37:57 +0100 Subject: [PATCH] espeak: cleanup --- src/GAudioOutput.cc | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 0d21d1c40..2f597bdf5 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -26,6 +26,7 @@ This file is part of the QGROUNDCONTROL project * @brief Implementation of audio output * * @author Lorenz Meier + * @author Thomas Gubler * */ @@ -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_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 -- 2.22.0