Browse Source

move PopParamStack()

master
Juho Hiltunen 7 years ago
parent
commit
d6ed3a3320
3 changed files with 23 additions and 21 deletions
  1. 3
    21
      src/libespeak-ng/readclause.c
  2. 19
    0
      src/libespeak-ng/ssml.c
  3. 1
    0
      src/libespeak-ng/ssml.h

+ 3
- 21
src/libespeak-ng/readclause.c View File

@@ -549,24 +549,6 @@ static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output
return short_pause;
}

static void PopParamStack(int tag_type, char *outbuf, int *outix)
{
// unwind the stack up to and including the previous tag of this type
int ix;
int top = 0;

if (tag_type >= SSML_CLOSE)
tag_type -= SSML_CLOSE;

for (ix = 0; ix < n_param_stack; ix++) {
if (param_stack[ix].type == tag_type)
top = ix;
}
if (top > 0)
n_param_stack = top;
ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters);
}

wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
{
// Gets the value string for an attribute.
@@ -902,7 +884,7 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
case SSML_STYLE + SSML_CLOSE:
case SSML_PROSODY + SSML_CLOSE:
case SSML_EMPHASIS + SSML_CLOSE:
PopParamStack(tag_type, outbuf, outix);
PopParamStack(tag_type, outbuf, outix, &n_param_stack, (PARAM_STACK *) param_stack, (int *) speech_parameters);
break;
case SSML_PHONEME:
attr1 = GetSsmlAttribute(px, "alphabet");
@@ -1018,12 +1000,12 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters);

if (self_closing)
PopParamStack(tag_type, outbuf, outix);
PopParamStack(tag_type, outbuf, outix, &n_param_stack, (PARAM_STACK *) param_stack, (int *) speech_parameters);
else
audio_text = true;
return CLAUSE_NONE;
case SSML_AUDIO + SSML_CLOSE:
PopParamStack(tag_type, outbuf, outix);
PopParamStack(tag_type, outbuf, outix, &n_param_stack, (PARAM_STACK *) param_stack, (int *) speech_parameters);
audio_text = false;
return CLAUSE_NONE;
case SSML_BREAK:

+ 19
- 0
src/libespeak-ng/ssml.c View File

@@ -364,3 +364,22 @@ PARAM_STACK *PushParamStack(int tag_type, int *n_param_stack, PARAM_STACK *param
sp->parameter[ix] = -1;
return sp;
}

void PopParamStack(int tag_type, char *outbuf, int *outix, int *n_param_stack, PARAM_STACK *param_stack, int *speech_parameters)
{
// unwind the stack up to and including the previous tag of this type
int ix;
int top = 0;

if (tag_type >= SSML_CLOSE)
tag_type -= SSML_CLOSE;

for (ix = 0; ix < *n_param_stack; ix++) {
if (param_stack[ix].type == tag_type)
top = ix;
}
if (top > 0)
*n_param_stack = top;
ProcessParamStack(outbuf, outix, *n_param_stack, param_stack, speech_parameters);
}


+ 1
- 0
src/libespeak-ng/ssml.h View File

@@ -79,3 +79,4 @@ int GetVoiceAttributes(wchar_t *pw, int tag_type, SSML_STACK *ssml_sp, SSML_STAC
void ProcessParamStack(char *outbuf, int *outix, int n_param_stack, PARAM_STACK *param_stack, int *speech_parameters);
PARAM_STACK *PushParamStack(int tag_type, int *n_param_stack, PARAM_STACK *param_stack);
const char *VoiceFromStack(SSML_STACK *ssml_stack, int n_ssml_stack, espeak_VOICE *base_voice, char base_voice_variant_name[40]);
void PopParamStack(int tag_type, char *outbuf, int *outix, int *n_param_stack, PARAM_STACK *param_stack, int *speech_parameters);

Loading…
Cancel
Save