Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-03-11 13:41:02 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-03-11 13:41:02 (GMT)
commit7c514c075b3c23ead9d98008ace27075a84fa625 (patch)
treee94fcbc9e1ea9d155f40665b649f9ba1836337aa
parent5361ec70058c37864e2d164bda83d5747a8c54ae (diff)
Remove workaround code from word tracking
-rw-r--r--src/espeak.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/espeak.c b/src/espeak.c
index 7d5065b..3ccf137 100644
--- a/src/espeak.c
+++ b/src/espeak.c
@@ -235,8 +235,6 @@ play(Econtext *self, Espin *spin, gsize size_to_play)
gsize event;
gsize sample_offset = 0;
- gsize text_offset = -1;
- gsize text_len = 0;
for (event = spin->events_pos; TRUE; ++event)
{
@@ -248,29 +246,21 @@ play(Econtext *self, Espin *spin, gsize size_to_play)
if (i->type == espeakEVENT_LIST_TERMINATED)
{
- GST_DEBUG("i->sample=%d", i->sample*2);
sample_offset = spin_size;
break;
}
else if (i->type == espeakEVENT_WORD)
{
+ if (i->text_position != spin->last_word)
+ {
+ emit_word(self, i->text_position, i->length);
+ spin->last_word = i->text_position;
+ }
sample_offset = i[1].sample*2;
- text_offset = i->text_position;
- text_len = i->length;
-
- GST_DEBUG("sample_offset=%d txt_offset=%d txt_len=%d, txt=%s",
- sample_offset, text_offset, text_len,
- self->text + text_offset);
break;
}
}
- if (text_offset != -1 && text_offset > spin->last_word)
- {
- spin->last_word = text_offset + text_len;
- emit_word(self, text_offset, text_len);
- }
-
if (sample_offset - spin->sound_offset > size_to_play)
{
GST_DEBUG("sample_offset=%zd spin->sound_offset=%zd",
@@ -278,9 +268,7 @@ play(Econtext *self, Espin *spin, gsize size_to_play)
return size_to_play;
}
- if (text_offset != -1)
- spin->events_pos = event + 1;
-
+ spin->events_pos = event + 1;
return sample_offset - spin->sound_offset;
}
@@ -289,7 +277,7 @@ play(Econtext *self, Espin *spin, gsize size_to_play)
if (spin->mark_name)
{
emit_mark(self, spin->mark_offset, spin->mark_name);
- spin->mark_offset = -1;
+ spin->mark_offset = 0;
spin->mark_name = NULL;
}
@@ -518,7 +506,7 @@ synth(Econtext *self, Espin *spin)
g_array_set_size(spin->events, 0);
spin->sound_offset = 0;
spin->events_pos = 0;
- spin->mark_offset = -1;
+ spin->mark_offset = 0;
spin->mark_name = NULL;
spin->last_word = -1;
spin->last_mark = 0;