From 0471ff47f4dc031cf70b14eb15128fd60fb185dd Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Fri, 26 Jun 2009 11:34:28 -0500 Subject: [PATCH] add support for the user_data parameter to espeak_synth The user_data parameter is just a pointer that is passed into the espeak_synth call that is passed back to the callback. In native mode, we are not using it since there is not a callback. However, in alsa mode, it will be used to indicate when a cancel was processed. --- synth.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/synth.c b/synth.c index 991a11a..1ef8250 100644 --- a/synth.c +++ b/synth.c @@ -37,6 +37,7 @@ const int rateMultiplier = 34; const int rateOffset = 84; const int volumeMultiplier = 22; +static int user_data = 0; volatile int runner_must_stop = 0; static espeak_ERROR set_frequency(struct synth_t *s, int freq, enum adjust_t adj) @@ -125,8 +126,12 @@ static espeak_ERROR set_volume(struct synth_t * s, int vol, enum adjust_t adj) static espeak_ERROR stop_speech(void) { + espeak_ERROR rc; + stop_audio(); - return (espeak_Cancel()); + rc = espeak_Cancel(); + user_data = (user_data + 1) % 100; + return rc; } static espeak_ERROR speak_text(struct synth_t * s) @@ -135,7 +140,7 @@ static espeak_ERROR speak_text(struct synth_t * s) allow_audio(); rc = espeak_Synth(s->buf, s->len + 1, 0, POS_CHARACTER, 0, 0, NULL, - NULL); + &user_data); return rc; }