[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/1] add get the list of synthesis voices (-L) to say.c
From: |
Andrei Kholodnyi |
Subject: |
[PATCH 1/1] add get the list of synthesis voices (-L) to say.c |
Date: |
Wed, 13 Oct 2010 18:45:59 +0200 |
spd_say can now retrieve a list of synthesis voices for particular
output module by calling spd_list_synthesis_voices
---
src/clients/say/options.c | 4 ++++
src/clients/say/options.h | 4 +++-
src/clients/say/say.c | 19 ++++++++++++++++++-
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/clients/say/options.c b/src/clients/say/options.c
index 3e140b2..416c83c 100644
--- a/src/clients/say/options.c
+++ b/src/clients/say/options.c
@@ -57,6 +57,7 @@ options_print_help(char *argv[])
"-t, --voice-type - Set the prefered voice type\n"
" (male1, male2, male3, female1,
female2\n"
" female3, child_male,
child_female)\n"
+ "-L, --list-synthesis-voices Get the list of synthesis voices\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"
@@ -156,6 +157,9 @@ options_parse(int argc, char *argv[])
case 't':
OPT_SET_STR(voice_type);
break;
+ case 'L':
+ list_synthesis_voices = 1;
+ break;
case 'm':
OPT_SET_STR(punctuation_mode);
break;
diff --git a/src/clients/say/options.h b/src/clients/say/options.h
index d9e6b4e..08b51e9 100644
--- a/src/clients/say/options.h
+++ b/src/clients/say/options.h
@@ -38,6 +38,7 @@ int spelling;
int wait_till_end;
int stop_previous;
int cancel_previous;
+int list_synthesis_voices;
char *application_name;
char *connection_name;
@@ -49,6 +50,7 @@ static struct option long_options[] = {
{"output-module", 1, 0, 'o'},
{"language", 1, 0, 'l'},
{"voice-type", 1, 0, 't'},
+ {"list-synthesis-voices", no_argument, 0, 'L'},
{"punctuation-mode", 1, 0, 'm'},
{"spelling", 0, 0, 's'},
{"ssml", 0, 0, 'x'},
@@ -64,7 +66,7 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
-static char* short_options = "r:p:i:l:o:t:m:sxeP:N:n:wSCvh";
+static char* short_options = "r:p:i:l:o:t:Lm: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 64b4bd8..cef46ec 100644
--- a/src/clients/say/say.c
+++ b/src/clients/say/say.c
@@ -68,6 +68,7 @@ int main(int argc, char **argv) {
wait_till_end = 0;
stop_previous = 0;
cancel_previous = 0;
+ list_synthesis_voices = 0;
pipe_mode = 0;
priority = NULL;
application_name = NULL;
@@ -77,7 +78,7 @@ int main(int argc, char **argv) {
/* Check if the text to say or options are specified in the argument */
msg_arg_required = (pipe_mode != 1) && (stop_previous != 1)
- && (cancel_previous != 1);
+ && (cancel_previous != 1) && (list_synthesis_voices !=
1);
if ((optind >= argc) && msg_arg_required) {
options_print_help(argv);
return 1;
@@ -142,6 +143,22 @@ int main(int argc, char **argv) {
}
}
+ if (list_synthesis_voices) {
+ SPDVoice **list;
+ int i;
+
+ list = spd_list_synthesis_voices(conn);
+ if (list != NULL) {
+ printf ("%25s%25s%25s\n","NAME", "LANGUAGE", "VARIANT");
+ for (i = 0; list[i]; i++) {
+ printf ("%25s%25s%25s\n", list[i]->name, list[i]->language,
+ list[i]->variant);
+ }
+ } else {
+ printf("Failed to get voice list.\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
- [PATCH 1/1] add get the list of synthesis voices (-L) to say.c,
Andrei Kholodnyi <=