From a06e24960036bb580752deae5dae330f13b9db99 Mon Sep 17 00:00:00 2001 From: Roman Moravcik Date: Mon, 14 Nov 2011 10:18:35 +0100 Subject: [PATCH] Added RealTTS support by Pali Rohar. --- debian/control | 2 +- src/tts.cpp | 20 +++++++++++++++++++- src/tts.hpp | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 437d2f3..7728723 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Vcs-Git: https://vcs.maemo.org/git/mstardict Package: mstardict Architecture: any -Depends: ${shlibs:Depends} +Depends: ${shlibs:Depends}, pulseaudio-utils Description: International dictionary for Maemo MStarDict is a StarDict clone written with using Gtk2 for Maemo. It can use StarDict DICT files as a word database for translation. diff --git a/src/tts.cpp b/src/tts.cpp index f557119..85b7147 100644 --- a/src/tts.cpp +++ b/src/tts.cpp @@ -111,6 +111,7 @@ static TtsVoice voices[] = { {"Mandarin", N_("Chinese (Mandarin)")}, {"cantonese-test", N_("Chinese (Cantonese)")}, {"default", N_("Default")}, + {"WyabdcRealPeopleTTS", N_("WyabdcRealPeopleTTS")}, {NULL, NULL} }; @@ -171,6 +172,11 @@ Tts::IsEnabled() void Tts::SetVoice(const gchar *language, int gender) { + if (g_strcmp0(language, "WyabdcRealPeopleTTS") == 0) + RealPeople = true; + else + RealPeople = false; + espeak_VOICE voice; memset(&voice, 0, sizeof(espeak_VOICE)); @@ -183,7 +189,19 @@ Tts::SetVoice(const gchar *language, int gender) void Tts::SayText(const gchar *sText) { - espeak_Synth(sText, strlen(sText) + 1, 0, POS_CHARACTER, 0, espeakCHARS_UTF8, NULL, NULL); + if (!RealPeople) { + espeak_Synth(sText, strlen(sText) + 1, 0, POS_CHARACTER, 0, espeakCHARS_UTF8, NULL, NULL); + return; + } + + gchar *lower = g_utf8_strdown(sText, -1); + gchar *cmd = g_strdup_printf("paplay /home/user/MyDocs/mstardict/WyabdcRealPeopleTTS/%c/%s.wav", lower[0], lower); + g_free(lower); + + system(cmd); + + g_free(cmd); + } GtkListStore * diff --git a/src/tts.hpp b/src/tts.hpp index fffabb2..3878743 100644 --- a/src/tts.hpp +++ b/src/tts.hpp @@ -34,6 +34,7 @@ class Tts { private: MStarDict *oStarDict; bool Enabled; + bool RealPeople; GtkWidget *enable_button; GtkWidget *gender_male_button; -- 1.7.9.5