From 36b05aec419a7ab7bc3b66358f62122096ec9ce2 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sat, 18 Oct 2008 16:56:47 -0500 Subject: [PATCH] Added support for the punctuation command from speakup --- espeakup.h | 4 ++++ queue.c | 3 +++ softsynth.c | 3 +++ synth.c | 14 ++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/espeakup.h b/espeakup.h index 7231927..2420c64 100644 --- a/espeakup.h +++ b/espeakup.h @@ -28,6 +28,7 @@ enum command_t { CMD_SET_FREQUENCY, CMD_SET_PITCH, + CMD_SET_PUNCTUATION, CMD_SET_RATE, CMD_SET_VOICE, CMD_SET_VOLUME, @@ -45,6 +46,7 @@ enum adjust_t { struct synth_t { int frequency; int pitch; + int punct; int rate; char voice[10]; int volume; @@ -64,6 +66,8 @@ extern espeak_ERROR set_frequency(struct synth_t *s, int freq, enum adjust_t adj); extern espeak_ERROR set_pitch(struct synth_t *s, int pitch, enum adjust_t adj); +extern espeak_ERROR set_punctuation(struct synth_t *s, int punct, + enum adjust_t adj); extern espeak_ERROR set_rate(struct synth_t *s, int rate, enum adjust_t adj); extern espeak_ERROR set_voice(struct synth_t *s, char *voice); diff --git a/queue.c b/queue.c index f10ea8b..f7640d0 100644 --- a/queue.c +++ b/queue.c @@ -120,6 +120,9 @@ void queue_process_entry(struct synth_t *s) case CMD_SET_PITCH: error = set_pitch(s, last->value, last->adjust); break; + case CMD_SET_PUNCTUATION: + error = set_punctuation(s, last->value, last->adjust); + break; case CMD_SET_RATE: error = set_rate(s, last->value, last->adjust); break; diff --git a/softsynth.c b/softsynth.c index bfa9969..4886b3b 100644 --- a/softsynth.c +++ b/softsynth.c @@ -65,6 +65,9 @@ static int process_command(struct synth_t *s, char *buf, int start) } switch (*cp) { + case 'b': + cmd = CMD_SET_PUNCTUATION; + break; case 'f': cmd = CMD_SET_FREQUENCY; break; diff --git a/synth.c b/synth.c index 375a7c0..94279fd 100644 --- a/synth.c +++ b/synth.c @@ -56,6 +56,20 @@ espeak_ERROR set_pitch(struct synth_t * s, int pitch, enum adjust_t adj) return rc; } +espeak_ERROR set_punctuation(struct synth_t * s, int punct, enum adjust_t adj) +{ + espeak_ERROR rc; + + if (adj == ADJ_DEC) + punct = -punct; + if (adj != ADJ_SET) + punct += s->punct; + rc = espeak_SetParameter(espeakPUNCTUATION, punct, 0); + if (rc == EE_OK) + s->punct = punct; + return rc; +} + espeak_ERROR set_rate(struct synth_t * s, int rate, enum adjust_t adj) { espeak_ERROR rc;