Added support for the punctuation command from speakup

This commit is contained in:
William Hubbs 2008-10-18 16:56:47 -05:00
commit 36b05aec41
4 changed files with 24 additions and 0 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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;

14
synth.c
View file

@ -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;