speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] add set synthesis voice option (-y) to say.c


From: Andrei Kholodnyi
Subject: [PATCH 1/3] add set synthesis voice option (-y) to say.c
Date: Wed, 13 Oct 2010 19:41:04 +0200

spd_say can now set a synthesis voices for particular
output module by calling set_synthesis_voice
---
 src/clients/say/options.c |    4 ++++
 src/clients/say/options.h |    4 +++-
 src/clients/say/say.c     |    5 +++++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/clients/say/options.c b/src/clients/say/options.c
index 416c83c..77de4d8 100644
--- a/src/clients/say/options.c
+++ b/src/clients/say/options.c
@@ -58,6 +58,7 @@ options_print_help(char *argv[])
            "                               (male1, male2, male3, female1, 
female2\n"
           "                                female3, child_male, 
child_female)\n"
            "-L, --list-synthesis-voices  Get the list of synthesis voices\n"
+           "-y, --synthesis-voice  -     Set the synthesis voice\n"
           "-m, --punctuation-mode -     Set the punctuation mode (none, some, 
all) \n"
           "-s, --spelling         -     Spell the message\n"
            "-x, --ssml             -     Set SSML mode on (default: off)\n"
@@ -160,6 +161,9 @@ options_parse(int argc, char *argv[])
         case 'L':
             list_synthesis_voices = 1;
             break;
+       case 'y':
+            OPT_SET_STR(synthesis_voice);
+            break;
         case 'm':
             OPT_SET_STR(punctuation_mode);
             break;
diff --git a/src/clients/say/options.h b/src/clients/say/options.h
index 08b51e9..c5e7226 100644
--- a/src/clients/say/options.h
+++ b/src/clients/say/options.h
@@ -39,6 +39,7 @@ int wait_till_end;
 int stop_previous;
 int cancel_previous;
 int list_synthesis_voices;
+char *synthesis_voice;
 
 char *application_name;
 char *connection_name;
@@ -51,6 +52,7 @@ static struct option long_options[] = {
     {"language", 1, 0, 'l'},
     {"voice-type", 1, 0, 't'},
     {"list-synthesis-voices", no_argument, 0, 'L'},
+    {"synthesis-voice", required_argument, 0, 'y'},
     {"punctuation-mode", 1, 0, 'm'},
     {"spelling", 0, 0, 's'},
     {"ssml", 0, 0, 'x'},
@@ -66,7 +68,7 @@ static struct option long_options[] = {
     {0, 0, 0, 0}
 };
 
-static char* short_options = "r:p:i:l:o:t:Lm:sxeP:N:n:wSCvh";
+static char* short_options = "r:p:i:l:o:t:Ly:m:sxeP:N:n:wSCvh";
 
 int options_parse(int argc, char *argv[]);
 void options_print_version();
diff --git a/src/clients/say/say.c b/src/clients/say/say.c
index cef46ec..c49dea2 100644
--- a/src/clients/say/say.c
+++ b/src/clients/say/say.c
@@ -69,6 +69,7 @@ int main(int argc, char **argv) {
     stop_previous = 0;
     cancel_previous = 0;
     list_synthesis_voices = 0;
+    synthesis_voice = NULL;
     pipe_mode = 0;
     priority = NULL;
     application_name = NULL;
@@ -159,6 +160,10 @@ int main(int argc, char **argv) {
        }
     }
 
+    if (synthesis_voice != NULL)
+        if (spd_set_synthesis_voice(conn, synthesis_voice))
+            printf("Failed to set synthesis voice!\n");
+
     if (ssml_mode)
         if(spd_execute_command(conn, "SET SELF SSML_MODE ON"))
             printf("Failed to set SSML mode.\n");
-- 
1.6.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]