Browse Source

move ReplaceKeyName()

master
Juho Hiltunen 7 years ago
parent
commit
6c4d22b6d2
3 changed files with 26 additions and 25 deletions
  1. 0
    25
      src/libespeak-ng/readclause.c
  2. 25
    0
      src/libespeak-ng/ssml.c
  3. 1
    0
      src/libespeak-ng/ssml.h

+ 0
- 25
src/libespeak-ng/readclause.c View File

@@ -669,31 +669,6 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp)
}
}

static int ReplaceKeyName(char *outbuf, int index, int *outix)
{
// Replace some key-names by single characters, so they can be pronounced in different languages
static MNEM_TAB keynames[] = {
{ "space ", 0xe020 },
{ "tab ", 0xe009 },
{ "underscore ", 0xe05f },
{ "double-quote ", '"' },
{ NULL, 0 }
};

int ix;
int letter;
char *p;

p = &outbuf[index];

if ((letter = LookupMnem(keynames, p)) != 0) {
ix = utf8_out(letter, p);
*outix = index + ix;
return letter;
}
return 0;
}

static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, bool self_closing)
{
// xml_buf is the tag and attributes with a zero terminator in place of the original '>'

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

@@ -414,3 +414,28 @@ wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
return NULL;
}

int ReplaceKeyName(char *outbuf, int index, int *outix)
{
// Replace some key-names by single characters, so they can be pronounced in different languages
static MNEM_TAB keynames[] = {
{ "space ", 0xe020 },
{ "tab ", 0xe009 },
{ "underscore ", 0xe05f },
{ "double-quote ", '"' },
{ NULL, 0 }
};

int ix;
int letter;
char *p;

p = &outbuf[index];

if ((letter = LookupMnem(keynames, p)) != 0) {
ix = utf8_out(letter, p);
*outix = index + ix;
return letter;
}
return 0;
}


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

@@ -81,3 +81,4 @@ void ProcessParamStack(char *outbuf, int *outix, int n_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]);
void PopParamStack(int tag_type, char *outbuf, int *outix, int *n_param_stack, PARAM_STACK *param_stack, int *speech_parameters);
int ReplaceKeyName(char *outbuf, int index, int *outix);

Loading…
Cancel
Save