[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] API - Clean up voice/voice_type inconsistancies
From: |
Luke Yelavich |
Subject: |
[PATCH] API - Clean up voice/voice_type inconsistancies |
Date: |
Mon, 11 May 2015 12:52:54 +1000 |
From: Luke Yelavich <address@hidden>
To: address@hidden
The C API has set/get voice_type, the SSIP API has set/get voice. Change the
SSIP API to be consistant with the C API.
The SET VOICE SSIP command is now deprecated, and will be removed in 0.9.
The server code does provide for a GET VOICE command, but it was not
documented, so it has been renamed as per above.
---
doc/ssip.texi | 26 ++++++++++++++++++++++++++
src/api/c/libspeechd.c | 16 ++++++++--------
src/api/python/speechd/client.py | 2 +-
src/server/parse.c | 10 +++++-----
4 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/doc/ssip.texi b/doc/ssip.texi
index 744b964..eaf6e4e 100644
--- a/doc/ssip.texi
+++ b/doc/ssip.texi
@@ -989,6 +989,32 @@ The default for the Speech Dispatcher implementation of
SSIP
is determined by the @code{DefaultVoiceType} setting in the
@code{speechd.conf} file. The factory default is @code{MALE1}.
+This command is deprecated since Speech Dispatcher 0.8.3. The VOICE_TYPE
+command replaces this command.
+
+ at item SET @{ all | self | @var{id} @} VOICE_TYPE @var{name}
+Set the voice identified by @var{name}. @var{name} must be one of the voice
+identifiers returned by the command @code{LIST VOICES} (@pxref{Information
+Retrieval Commands}).
+
+There is a standard set of voice identifiers defined in @ref{Standard
+Voices}.
+
+The default for the Speech Dispatcher implementation of SSIP
+is determined by the @code{DefaultVoiceType} setting in the
+ at code{speechd.conf} file. The factory default is @code{MALE1}.
+
+ at item GET VOICE_TYPE
+Gets the current pre-defined voice. A list of voice identifiers can be
+obtained by the command @code{LIST VOICES} (@pxref{Information
+Retrieval Commands}).
+
+ at example
+GET VOICE_TYPE
+251-MALE1
+251 OK GET RETURNED
+ at end example
+
@item SET @{ all | self | @var{id} @} SYNTHESIS_VOICE @var{name}
Set the voice identified by @var{name}. @var{name} is a voice name
recognized by the current synthesizer. It must be one of the names
diff --git a/src/api/c/libspeechd.c b/src/api/c/libspeechd.c
index f47baa1..3651232 100644
--- a/src/api/c/libspeechd.c
+++ b/src/api/c/libspeechd.c
@@ -970,28 +970,28 @@ spd_w_set_voice_type(SPDConnection * connection,
SPDVoiceType type,
switch (type) {
case SPD_MALE1:
- sprintf(command, "SET %s VOICE MALE1", who);
+ sprintf(command, "SET %s VOICE_TYPE MALE1", who);
break;
case SPD_MALE2:
- sprintf(command, "SET %s VOICE MALE2", who);
+ sprintf(command, "SET %s VOICE_TYPE MALE2", who);
break;
case SPD_MALE3:
- sprintf(command, "SET %s VOICE MALE3", who);
+ sprintf(command, "SET %s VOICE_TYPE MALE3", who);
break;
case SPD_FEMALE1:
- sprintf(command, "SET %s VOICE FEMALE1", who);
+ sprintf(command, "SET %s VOICE_TYPE FEMALE1", who);
break;
case SPD_FEMALE2:
- sprintf(command, "SET %s VOICE FEMALE2", who);
+ sprintf(command, "SET %s VOICE_TYPE FEMALE2", who);
break;
case SPD_FEMALE3:
- sprintf(command, "SET %s VOICE FEMALE3", who);
+ sprintf(command, "SET %s VOICE_TYPE FEMALE3", who);
break;
case SPD_CHILD_MALE:
- sprintf(command, "SET %s VOICE CHILD_MALE", who);
+ sprintf(command, "SET %s VOICE_TYPE CHILD_MALE", who);
break;
case SPD_CHILD_FEMALE:
- sprintf(command, "SET %s VOICE CHILD_FEMALE", who);
+ sprintf(command, "SET %s VOICE_TYPE CHILD_FEMALE", who);
break;
default:
return -1;
diff --git a/src/api/python/speechd/client.py b/src/api/python/speechd/client.py
index 4c57db0..9d5ccd2 100644
--- a/src/api/python/speechd/client.py
+++ b/src/api/python/speechd/client.py
@@ -1013,7 +1013,7 @@ class SSIPClient(object):
value.lower() in ("male1", "male2", "male3", "female1",
"female2", "female3", "child_male",
"child_female")
- self._conn.send_command('SET', scope, 'VOICE', value)
+ self._conn.send_command('SET', scope, 'VOICE_TYPE', value)
def set_synthesis_voice(self, value, scope=Scope.SELF):
"""Set voice by its real name.
diff --git a/src/server/parse.c b/src/server/parse.c
index 337763b..18fcc4c 100644
--- a/src/server/parse.c
+++ b/src/server/parse.c
@@ -529,13 +529,16 @@ char *parse_set(const char *buf, const int bytes, const
int fd,
if (ret)
return g_strdup(ERR_COULDNT_SET_VOLUME);
return g_strdup(OK_VOLUME_SET);
- } else if (TEST_CMD(set_sub, "voice")) {
+ } else if (TEST_CMD(set_sub, "voice") || TEST_CMD(set_sub,
"voice_type")) {
char *voice;
GET_PARAM_STR(voice, 3, CONV_DOWN);
SSIP_SET_COMMAND(voice);
g_free(voice);
+ if (TEST_CMD(set_sub, "voice"))
+ MSG(1, "The SET VOICE command is deprecated since
Speech Dispatcher 0.8.3.");
+
if (ret)
return g_strdup(ERR_COULDNT_SET_VOICE);
return g_strdup(OK_VOICE_SET);
@@ -956,7 +959,7 @@ char *parse_get(const char *buf, const int bytes, const int
fd,
result = g_string_new("");
GET_PARAM_STR(get_type, 1, CONV_DOWN);
- if (TEST_CMD(get_type, "voice")) {
+ if (TEST_CMD(get_type, "voice_type")) {
switch (settings->msg_settings.voice_type) {
case SPD_MALE1:
g_string_append(result, C_OK_GET "-MALE1" NEWLINE
OK_GET);
@@ -1004,9 +1007,6 @@ char *parse_get(const char *buf, const int bytes, const
int fd,
} else if (TEST_CMD(get_type, "volume")) {
g_string_append_printf(result, C_OK_GET "-%d" NEWLINE OK_GET,
settings->msg_settings.volume);
- } else if (TEST_CMD(get_type, "voice_type")) {
- g_string_append_printf(result, C_OK_GET "-%d" NEWLINE OK_GET,
- settings->msg_settings.voice_type);
} else {
g_free(get_type);
g_string_append(result, ERR_PARAMETER_INVALID);
--
2.1.4