|
|
|
|
|
|
|
|
static char base_voice_variant_name[40] = { 0 }; |
|
|
static char base_voice_variant_name[40] = { 0 }; |
|
|
static char current_voice_id[40] = { 0 }; |
|
|
static char current_voice_id[40] = { 0 }; |
|
|
|
|
|
|
|
|
#define N_PARAM_STACK 20 |
|
|
|
|
|
static int n_param_stack; |
|
|
static int n_param_stack; |
|
|
PARAM_STACK param_stack[N_PARAM_STACK]; |
|
|
PARAM_STACK param_stack[N_PARAM_STACK]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return short_pause; |
|
|
return short_pause; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void ProcessParamStack(char *outbuf, int *outix) |
|
|
|
|
|
{ |
|
|
|
|
|
// Set the speech parameters from the parameter stack |
|
|
|
|
|
int param; |
|
|
|
|
|
int ix; |
|
|
|
|
|
int value; |
|
|
|
|
|
char buf[20]; |
|
|
|
|
|
int new_parameters[N_SPEECH_PARAM]; |
|
|
|
|
|
static char cmd_letter[N_SPEECH_PARAM] = { 0, 'S', 'A', 'P', 'R', 0, 'C', 0, 0, 0, 0, 0, 'F' }; // embedded command letters |
|
|
|
|
|
|
|
|
|
|
|
for (param = 0; param < N_SPEECH_PARAM; param++) |
|
|
|
|
|
new_parameters[param] = -1; |
|
|
|
|
|
|
|
|
|
|
|
for (ix = 0; ix < n_param_stack; ix++) { |
|
|
|
|
|
for (param = 0; param < N_SPEECH_PARAM; param++) { |
|
|
|
|
|
if (param_stack[ix].parameter[param] >= 0) |
|
|
|
|
|
new_parameters[param] = param_stack[ix].parameter[param]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (param = 0; param < N_SPEECH_PARAM; param++) { |
|
|
|
|
|
if ((value = new_parameters[param]) != speech_parameters[param]) { |
|
|
|
|
|
buf[0] = 0; |
|
|
|
|
|
|
|
|
|
|
|
switch (param) |
|
|
|
|
|
{ |
|
|
|
|
|
case espeakPUNCTUATION: |
|
|
|
|
|
option_punctuation = value-1; |
|
|
|
|
|
break; |
|
|
|
|
|
case espeakCAPITALS: |
|
|
|
|
|
option_capitals = value; |
|
|
|
|
|
break; |
|
|
|
|
|
case espeakRATE: |
|
|
|
|
|
case espeakVOLUME: |
|
|
|
|
|
case espeakPITCH: |
|
|
|
|
|
case espeakRANGE: |
|
|
|
|
|
case espeakEMPHASIS: |
|
|
|
|
|
sprintf(buf, "%c%d%c", CTRL_EMBEDDED, value, cmd_letter[param]); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
speech_parameters[param] = new_parameters[param]; |
|
|
|
|
|
strcpy(&outbuf[*outix], buf); |
|
|
|
|
|
*outix += strlen(buf); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static PARAM_STACK *PushParamStack(int tag_type) |
|
|
static PARAM_STACK *PushParamStack(int tag_type) |
|
|
{ |
|
|
{ |
|
|
int ix; |
|
|
int ix; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (top > 0) |
|
|
if (top > 0) |
|
|
n_param_stack = top; |
|
|
n_param_stack = top; |
|
|
ProcessParamStack(outbuf, outix); |
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
value = attrlookup(attr2, mnem_capitals); |
|
|
value = attrlookup(attr2, mnem_capitals); |
|
|
sp->parameter[espeakCAPITALS] = value; |
|
|
sp->parameter[espeakCAPITALS] = value; |
|
|
} |
|
|
} |
|
|
ProcessParamStack(outbuf, outix); |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
SetProsodyParameter(param_type, attr1, sp); |
|
|
SetProsodyParameter(param_type, attr1, sp); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ProcessParamStack(outbuf, outix); |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
sp->parameter[espeakVOLUME] = emphasis_to_volume2[value]; |
|
|
sp->parameter[espeakVOLUME] = emphasis_to_volume2[value]; |
|
|
sp->parameter[espeakEMPHASIS] = value; |
|
|
sp->parameter[espeakEMPHASIS] = value; |
|
|
} |
|
|
} |
|
|
ProcessParamStack(outbuf, outix); |
|
|
|
|
|
|
|
|
ProcessParamStack(outbuf, outix, n_param_stack, param_stack, speech_parameters); |
|
|
break; |
|
|
break; |
|
|
case SSML_STYLE + SSML_CLOSE: |
|
|
case SSML_STYLE + SSML_CLOSE: |
|
|
case SSML_PROSODY + SSML_CLOSE: |
|
|
case SSML_PROSODY + SSML_CLOSE: |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
ProcessParamStack(outbuf, outix); |
|
|
|
|
|
|
|
|
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); |