mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-21 03:24:48 +00:00
Fix crash: SSML when <voice name=""> has an unrecognised voice name.
SSML: Don't speak text within <metadata> </metadata> git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@145 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+10
-1
@@ -190,6 +190,8 @@ int iswalpha(int c)
|
||||
{
|
||||
if(c < 0x100)
|
||||
return(isalpha(c));
|
||||
if((c > 0x3040) && (c <= 0xa700))
|
||||
return(1); // japanese, chinese characters
|
||||
if(c > MAX_WALPHA)
|
||||
return(0);
|
||||
return(walpha_tab[c-0x100]);
|
||||
@@ -758,6 +760,7 @@ int Translator::AnnouncePunctuation(int c1, int c2, char *buf, int bufix)
|
||||
#define SSML_AUDIO 11
|
||||
#define SSML_EMPHASIS 12
|
||||
#define SSML_BREAK 13
|
||||
#define SSML_METADATA 14
|
||||
#define HTML_BREAK 15
|
||||
#define SSML_CLOSE 0x10 // for a closing tag, OR this with the tag type
|
||||
|
||||
@@ -779,6 +782,7 @@ MNEM_TAB ssmltags[] = {
|
||||
{"audio", SSML_AUDIO},
|
||||
{"emphasis", SSML_EMPHASIS},
|
||||
{"break", SSML_BREAK},
|
||||
{"metadata", SSML_METADATA},
|
||||
|
||||
{"br", HTML_BREAK},
|
||||
{"li", HTML_BREAK},
|
||||
@@ -816,7 +820,7 @@ static const char *VoiceFromStack()
|
||||
{
|
||||
sp = &ssml_stack[ix];
|
||||
|
||||
if(sp->voice_name[0] != 0)
|
||||
if((sp->voice_name[0] != 0) && (SelectVoiceByName(NULL,sp->voice_name) != NULL))
|
||||
{
|
||||
strcpy(voice_name, sp->voice_name);
|
||||
language[0] = 0;
|
||||
@@ -1495,7 +1499,12 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outb
|
||||
}
|
||||
break;
|
||||
|
||||
case SSML_METADATA:
|
||||
ignore_text = 1;
|
||||
break;
|
||||
|
||||
case SSML_SUB + SSML_CLOSE:
|
||||
case SSML_METADATA + SSML_CLOSE:
|
||||
ignore_text = 0;
|
||||
break;
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ extern voice_t *voice;
|
||||
extern int tone_points[10];
|
||||
|
||||
const char *SelectVoice(espeak_VOICE *voice_select);
|
||||
espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name);
|
||||
voice_t *LoadVoice(const char *voice_name, int control);
|
||||
voice_t *LoadVoiceVariant(const char *voice_name, int variant);
|
||||
void DoVoiceChange(voice_t *v);
|
||||
|
||||
+9
-2
@@ -1221,8 +1221,8 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int
|
||||
|
||||
|
||||
|
||||
static espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name)
|
||||
{//============================================================================
|
||||
espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name)
|
||||
{//=====================================================================
|
||||
int ix;
|
||||
int match_fname = -1;
|
||||
int match_fname2 = -1;
|
||||
@@ -1231,6 +1231,13 @@ static espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name)
|
||||
int last_part_len;
|
||||
char last_part[41];
|
||||
|
||||
if(voices == NULL)
|
||||
{
|
||||
if(n_voices_list == 0)
|
||||
espeak_ListVoices(NULL); // create the voices list
|
||||
voices = voices_list;
|
||||
}
|
||||
|
||||
sprintf(last_part,"%c%s",PATHSEP,name);
|
||||
last_part_len = strlen(last_part);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user