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

return short_pause; 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) wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
{ {
// Gets the value string for an attribute. // Gets the value string for an attribute.
case SSML_STYLE + SSML_CLOSE: case SSML_STYLE + SSML_CLOSE:
case SSML_PROSODY + SSML_CLOSE: case SSML_PROSODY + SSML_CLOSE:
case SSML_EMPHASIS + 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; break;
case SSML_PHONEME: case SSML_PHONEME:
attr1 = GetSsmlAttribute(px, "alphabet"); attr1 = GetSsmlAttribute(px, "alphabet");
ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters); ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters);


if (self_closing) if (self_closing)
PopParamStack(tag_type, outbuf, outix);
PopParamStack(tag_type, outbuf, outix, &n_param_stack, (PARAM_STACK *) param_stack, (int *) speech_parameters);
else else
audio_text = true; audio_text = true;
return CLAUSE_NONE; return CLAUSE_NONE;
case SSML_AUDIO + SSML_CLOSE: 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; audio_text = false;
return CLAUSE_NONE; return CLAUSE_NONE;
case SSML_BREAK: case SSML_BREAK:

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

sp->parameter[ix] = -1; sp->parameter[ix] = -1;
return sp; 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

void ProcessParamStack(char *outbuf, int *outix, int n_param_stack, PARAM_STACK *param_stack, int *speech_parameters); 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); 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]); 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