diff --git a/src/readclause.cpp b/src/readclause.cpp index 549d4ae1..d9f6222b 100644 --- a/src/readclause.cpp +++ b/src/readclause.cpp @@ -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; diff --git a/src/voice.h b/src/voice.h index 275c7c45..de6da774 100644 --- a/src/voice.h +++ b/src/voice.h @@ -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); diff --git a/src/voices.cpp b/src/voices.cpp index 2ed11796..ba847854 100755 --- a/src/voices.cpp +++ b/src/voices.cpp @@ -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);