[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] API - Clean up voice/voice_type inconsistancies
From: |
Jeremy Whiting |
Subject: |
[PATCH] API - Clean up voice/voice_type inconsistancies |
Date: |
Fri, 8 May 2015 06:30:37 -0600 |
Those look good to me, except we should probably not use the
deprecated syntax in the @example in the documentation. Should be GET
VOICE_TYPE not GET VOICE, right?
On Thu, May 7, 2015 at 9:18 PM, Luke Yelavich
<luke.yelavich at canonical.com> wrote:
> From: Luke Yelavich <themuso at themuso.com>
>
> 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. Also remove the SET VOICE SSIP
> command.
>
> 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 | 13 ++++++++++++-
> src/api/c/libspeechd.c | 16 ++++++++--------
> src/api/python/speechd/client.py | 2 +-
> src/server/parse.c | 7 ++-----
> 4 files changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/doc/ssip.texi b/doc/ssip.texi
> index 744b964..9587712 100644
> --- a/doc/ssip.texi
> +++ b/doc/ssip.texi
> @@ -977,7 +977,7 @@ The default for the Speech Dispatcher implementation of
> SSIP
> is determined by the @code{DefaultCapLetRecognition} setting in the
> @code{speechd.conf} file. The factory default is @code{none}.
>
> - at item SET @{ all | self | @var{id} @} VOICE @var{name}
> + 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}).
> @@ -989,6 +989,17 @@ 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}.
>
> + 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
> +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 8cb7e51..09d0a14 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 85c20ca..e7a4699 100644
> --- a/src/api/python/speechd/client.py
> +++ b/src/api/python/speechd/client.py
> @@ -1025,7 +1025,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 5c55330..95ce6c7 100644
> --- a/src/server/parse.c
> +++ b/src/server/parse.c
> @@ -542,7 +542,7 @@ 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_type")) {
> char *voice;
> GET_PARAM_STR(voice, 3, CONV_DOWN);
>
> @@ -969,7 +969,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);
> @@ -1017,9 +1017,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
>
>
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd