SSML: Don't speak text within <metadata> </metadata> git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@145 d46cf337-b52f-0410-862d-fd96e6ae7743master
| { | { | ||||
| if(c < 0x100) | if(c < 0x100) | ||||
| return(isalpha(c)); | return(isalpha(c)); | ||||
| if((c > 0x3040) && (c <= 0xa700)) | |||||
| return(1); // japanese, chinese characters | |||||
| if(c > MAX_WALPHA) | if(c > MAX_WALPHA) | ||||
| return(0); | return(0); | ||||
| return(walpha_tab[c-0x100]); | return(walpha_tab[c-0x100]); | ||||
| #define SSML_AUDIO 11 | #define SSML_AUDIO 11 | ||||
| #define SSML_EMPHASIS 12 | #define SSML_EMPHASIS 12 | ||||
| #define SSML_BREAK 13 | #define SSML_BREAK 13 | ||||
| #define SSML_METADATA 14 | |||||
| #define HTML_BREAK 15 | #define HTML_BREAK 15 | ||||
| #define SSML_CLOSE 0x10 // for a closing tag, OR this with the tag type | #define SSML_CLOSE 0x10 // for a closing tag, OR this with the tag type | ||||
| {"audio", SSML_AUDIO}, | {"audio", SSML_AUDIO}, | ||||
| {"emphasis", SSML_EMPHASIS}, | {"emphasis", SSML_EMPHASIS}, | ||||
| {"break", SSML_BREAK}, | {"break", SSML_BREAK}, | ||||
| {"metadata", SSML_METADATA}, | |||||
| {"br", HTML_BREAK}, | {"br", HTML_BREAK}, | ||||
| {"li", HTML_BREAK}, | {"li", HTML_BREAK}, | ||||
| { | { | ||||
| sp = &ssml_stack[ix]; | 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); | strcpy(voice_name, sp->voice_name); | ||||
| language[0] = 0; | language[0] = 0; | ||||
| } | } | ||||
| break; | break; | ||||
| case SSML_METADATA: | |||||
| ignore_text = 1; | |||||
| break; | |||||
| case SSML_SUB + SSML_CLOSE: | case SSML_SUB + SSML_CLOSE: | ||||
| case SSML_METADATA + SSML_CLOSE: | |||||
| ignore_text = 0; | ignore_text = 0; | ||||
| break; | break; | ||||
| extern int tone_points[10]; | extern int tone_points[10]; | ||||
| const char *SelectVoice(espeak_VOICE *voice_select); | 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 *LoadVoice(const char *voice_name, int control); | ||||
| voice_t *LoadVoiceVariant(const char *voice_name, int variant); | voice_t *LoadVoiceVariant(const char *voice_name, int variant); | ||||
| void DoVoiceChange(voice_t *v); | void DoVoiceChange(voice_t *v); |
| static espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name) | |||||
| {//============================================================================ | |||||
| espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name) | |||||
| {//===================================================================== | |||||
| int ix; | int ix; | ||||
| int match_fname = -1; | int match_fname = -1; | ||||
| int match_fname2 = -1; | int match_fname2 = -1; | ||||
| int last_part_len; | int last_part_len; | ||||
| char last_part[41]; | 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); | sprintf(last_part,"%c%s",PATHSEP,name); | ||||
| last_part_len = strlen(last_part); | last_part_len = strlen(last_part); | ||||