Browse Source

move PushParamStack()

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

+ 4
- 19
src/libespeak-ng/readclause.c View File

return short_pause; return short_pause;
} }


static PARAM_STACK *PushParamStack(int tag_type)
{
int ix;
PARAM_STACK *sp;

sp = &param_stack[n_param_stack];
if (n_param_stack < (N_PARAM_STACK-1))
n_param_stack++;

sp->type = tag_type;
for (ix = 0; ix < N_SPEECH_PARAM; ix++)
sp->parameter[ix] = -1;
return sp;
}

static void PopParamStack(int tag_type, char *outbuf, int *outix) static void PopParamStack(int tag_type, char *outbuf, int *outix)
{ {
// unwind the stack up to and including the previous tag of this type // unwind the stack up to and including the previous tag of this type
switch (tag_type) switch (tag_type)
{ {
case SSML_STYLE: case SSML_STYLE:
sp = PushParamStack(tag_type);
sp = PushParamStack(tag_type, &n_param_stack, (PARAM_STACK *) param_stack);
attr1 = GetSsmlAttribute(px, "field"); attr1 = GetSsmlAttribute(px, "field");
attr2 = GetSsmlAttribute(px, "mode"); attr2 = GetSsmlAttribute(px, "mode");


ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters); ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters);
break; break;
case SSML_PROSODY: case SSML_PROSODY:
sp = PushParamStack(tag_type);
sp = PushParamStack(tag_type, &n_param_stack, (PARAM_STACK *) param_stack);


// look for attributes: rate, volume, pitch, range // look for attributes: rate, volume, pitch, range
for (param_type = espeakRATE; param_type <= espeakRANGE; param_type++) { for (param_type = espeakRATE; param_type <= espeakRANGE; param_type++) {
ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters); ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters);
break; break;
case SSML_EMPHASIS: case SSML_EMPHASIS:
sp = PushParamStack(tag_type);
sp = PushParamStack(tag_type, &n_param_stack, (PARAM_STACK *) param_stack);
value = 3; // default is "moderate" value = 3; // default is "moderate"
if ((attr1 = GetSsmlAttribute(px, "level")) != NULL) if ((attr1 = GetSsmlAttribute(px, "level")) != NULL)
value = attrlookup(attr1, mnem_emphasis); value = attrlookup(attr1, mnem_emphasis);
} }
break; break;
case SSML_AUDIO: case SSML_AUDIO:
sp = PushParamStack(tag_type);
sp = PushParamStack(tag_type, &n_param_stack, (PARAM_STACK *)param_stack);


if ((attr1 = GetSsmlAttribute(px, "src")) != NULL) { if ((attr1 = GetSsmlAttribute(px, "src")) != NULL) {
char fname[256]; char fname[256];

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

} }
} }
} }
PARAM_STACK *PushParamStack(int tag_type, int *n_param_stack, PARAM_STACK *param_stack)
{
int ix;
PARAM_STACK *sp;

sp = &param_stack[*n_param_stack];
if (*n_param_stack < (N_PARAM_STACK-1))
*n_param_stack = *n_param_stack + 1;

sp->type = tag_type;
for (ix = 0; ix < N_SPEECH_PARAM; ix++)
sp->parameter[ix] = -1;
return sp;
}

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

}; };


int attrcmp(const wchar_t *string1, const char *string2); int attrcmp(const wchar_t *string1, const char *string2);
int attrcopy_utf8(char *buf, const wchar_t *pw, int len);
int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab); int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab);
int attrnumber(const wchar_t *pw, int default_value, int type); int attrnumber(const wchar_t *pw, int default_value, int type);
int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out); int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out);
int attrcopy_utf8(char *buf, const wchar_t *pw, int len);
int GetVoiceAttributes(wchar_t *pw, int tag_type, SSML_STACK *ssml_sp, SSML_STACK *ssml_stack, int n_ssml_stack, char current_voice_id[40], espeak_VOICE *base_voice, char base_voice_variant_name[40]); int GetVoiceAttributes(wchar_t *pw, int tag_type, SSML_STACK *ssml_sp, SSML_STACK *ssml_stack, int n_ssml_stack, char current_voice_id[40], espeak_VOICE *base_voice, char base_voice_variant_name[40]);
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);
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]);

Loading…
Cancel
Save