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-21 11:34:39 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-03-21 11:34:39 (GMT)
commit51ad08e7323b78c2a0a0ba12351c595929b57939 (patch)
tree94f811f780c5bb1486ae6c4124d7d217a8a0b3d0
parent5f40d8e8561a0a60fc8ab684360ed340779b860e (diff)
Revert marks related workaround code for 0.3 brach
-rw-r--r--src/espeak.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/espeak.c b/src/espeak.c
index 24e3765..b119e7d 100644
--- a/src/espeak.c
+++ b/src/espeak.c
@@ -57,6 +57,7 @@ typedef struct
int last_word;
int mark_offset;
const gchar *mark_name;
+ int last_mark;
} Espin;
struct _Econtext
@@ -446,10 +447,29 @@ synth_cb(short *data, int numsamples, espeak_EVENT *events)
// convert to 0-based position
--i->text_position;
+ // workaround to fix text_position related faults for mark events
if (i->type == espeakEVENT_MARK)
{
+ // suppress failed text_position values
+ const gchar *eom = strstr(self->text +
+ spin->last_mark, "/>");
+ if (eom)
+ {
+ 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(temporally) string
+ // espeak's allocated string
int l_quote, r_quote;
if ((r_quote = strbstr(self, i->text_position, "/>", 2)) != 0)
if ((r_quote = strbstr(self, r_quote, "\"", 1)) != 0)
@@ -484,6 +504,7 @@ synth(Econtext *self, Espin *spin)
spin->mark_offset = 0;
spin->mark_name = NULL;
spin->last_word = -1;
+ spin->last_mark = 0;
espeak_SetParameter(espeakPITCH, g_atomic_int_get(&self->pitch), 0);
espeak_SetParameter(espeakRATE, g_atomic_int_get(&self->rate), 0);