Added RealTTS support by Pali Rohar.
authorRoman Moravcik <roman.moravcik@gmail.com>
Mon, 14 Nov 2011 09:18:35 +0000 (10:18 +0100)
committerRoman Moravcik <roman.moravcik@gmail.com>
Mon, 14 Nov 2011 09:18:35 +0000 (10:18 +0100)
debian/control
src/tts.cpp
src/tts.hpp

index 437d2f3..7728723 100644 (file)
@@ -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.
index f557119..85b7147 100644 (file)
@@ -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 *
index fffabb2..3878743 100644 (file)
@@ -34,6 +34,7 @@ class Tts {
   private:
     MStarDict *oStarDict;
     bool Enabled;
+    bool RealPeople;
 
     GtkWidget *enable_button;
     GtkWidget *gender_male_button;