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.
This commit is contained in:
William Hubbs 2009-06-26 11:34:28 -05:00
commit 0471ff47f4

View file

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