diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-12 05:32:27 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-12 05:32:27 (GMT) |
commit | 9ed6c0d2b443d16c8d7862e201305e266c1d3dec (patch) | |
tree | fda520ae5b6e19795c18e9e46bb32da84cc8ec40 | |
parent | 0a44be3fafea75d593f33dbb2afd9b98edb12c25 (diff) |
A bit more workaround code to catch misplaced marks
-rw-r--r-- | src/espeak.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/espeak.c b/src/espeak.c index 3ccf137..87e773d 100644 --- a/src/espeak.c +++ b/src/espeak.c @@ -53,10 +53,10 @@ typedef struct GArray *events; gsize events_pos; - gsize last_word; - gsize mark_offset; + int last_word; + int mark_offset; const gchar *mark_name; - gsize last_mark; + int last_mark; } Espin; struct _Econtext @@ -445,14 +445,13 @@ synth_cb(short *data, int numsamples, espeak_EVENT *events) for (i = events; i->type != espeakEVENT_LIST_TERMINATED; ++i) { - // convert to 0-based position - --i->text_position; - GST_DEBUG("type=%d text_position=%d length=%d " "audio_position=%d sample=%d", i->type, i->text_position, i->length, i->audio_position, i->sample*2); + // convert to 0-based position + --i->text_position; // workaround to fix text_position related faults for mark events if (i->type == espeakEVENT_MARK) @@ -464,19 +463,21 @@ synth_cb(short *data, int numsamples, espeak_EVENT *events) spin->last_mark, "/>"); if (eom) { - gsize pos = eom - self->text + 2; + int pos = eom - self->text + 2; if (i->text_position <= spin->last_mark || pos > i->text_position) i->text_position = pos; } + else if (i->text_position <= spin->last_mark) + i->text_position = spin->last_mark; } spin->last_mark = i->text_position; // point mark name to text substring instead of using // espeak's allocated string - gsize l_quote, r_quote; + int l_quote, r_quote; if ((r_quote = strbstr(self, i->text_position, "/>", 2)) != 0) if ((r_quote = strbstr(self, r_quote, "\"", 1)) != 0) if ((l_quote = strbstr(self, r_quote, "\"", 1)) != 0) |