mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-07 23:31:26 +00:00
Merge branch 'development'
Conflicts: src/speech.h
This commit is contained in:
+28
-5
@@ -192,12 +192,35 @@ const char *LookupMnemName(MNEM_TAB *table, const int value)
|
||||
} /* end of LookupMnemValue */
|
||||
|
||||
|
||||
char *print_dictionary_flags(unsigned int *flags)
|
||||
{//==============================================
|
||||
static char buf[20];
|
||||
void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len)
|
||||
{//========================================================================
|
||||
int stress;
|
||||
int ix;
|
||||
const char *name;
|
||||
int len;
|
||||
int total = 0;
|
||||
|
||||
sprintf(buf,"%s 0x%x/%x",LookupMnemName(mnem_flags,(flags[0] & 0xf)+0x40), flags[0], flags[1]);
|
||||
return(buf);
|
||||
buf[0] = 0;
|
||||
if((stress = flags[0] & 0xf) != 0)
|
||||
{
|
||||
sprintf(buf, "%s", LookupMnemName(mnem_flags, stress + 0x40));
|
||||
total = strlen(buf);
|
||||
buf += total;
|
||||
}
|
||||
|
||||
for(ix=8; ix<64; ix++)
|
||||
{
|
||||
if(((ix < 30) && (flags[0] & (1 << ix))) || ((ix >= 0x20) && (flags[1] & (1 << (ix-0x20)))))
|
||||
{
|
||||
name = LookupMnemName(mnem_flags, ix);
|
||||
len = strlen(name) + 1;
|
||||
total += len;
|
||||
if(total >= buf_len)
|
||||
continue;
|
||||
sprintf(buf, " %s", name);
|
||||
buf += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+16
-50
@@ -37,7 +37,7 @@
|
||||
int dictionary_skipwords;
|
||||
char dictionary_name[40];
|
||||
|
||||
extern char *print_dictionary_flags(unsigned int *flags);
|
||||
extern void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len);
|
||||
extern char *DecodeRule(const char *group_chars, int group_length, char *rule, int control);
|
||||
|
||||
// accented characters which indicate (in some languages) the start of a separate syllable
|
||||
@@ -770,7 +770,7 @@ static int IsLetterGroup(Translator *tr, char *word, int group, int pre)
|
||||
{
|
||||
w = word;
|
||||
}
|
||||
while(*p == *w)
|
||||
while((*p == *w) && (*w != 0))
|
||||
{
|
||||
w++;
|
||||
p++;
|
||||
@@ -2715,7 +2715,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
p += (wc_bytes-1);
|
||||
}
|
||||
|
||||
if(((alphabet = AlphabetFromChar(letter)) != NULL) && (alphabet->language != 0) && (alphabet->offset != tr->letter_bits_offset))
|
||||
if(((alphabet = AlphabetFromChar(letter)) != NULL) && (alphabet->flags & AL_WORDS) && (alphabet->offset != tr->letter_bits_offset))
|
||||
{
|
||||
// switch to the nominated language for this alphabet
|
||||
sprintf(phonemes,"%c%s",phonSWITCH, WordToString2(alphabet->language));
|
||||
@@ -2808,8 +2808,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
}
|
||||
}
|
||||
|
||||
// any language specific changes ?
|
||||
ApplySpecialAttribute(tr,phonemes,dict_flags0);
|
||||
memcpy(p_start,word_copy,strlen(word_copy));
|
||||
|
||||
return(0);
|
||||
@@ -2853,46 +2851,6 @@ void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags)
|
||||
} // end of ApplySpecialAttribute2
|
||||
|
||||
|
||||
void ApplySpecialAttribute(Translator *tr, char *phonemes, int dict_flags)
|
||||
{//=======================================================================
|
||||
// Amend the translated phonemes according to an attribute which is specific for the language.
|
||||
int len;
|
||||
char *p_end;
|
||||
|
||||
if((dict_flags & (FLAG_ALT_TRANS | FLAG_ALT2_TRANS)) == 0)
|
||||
return;
|
||||
|
||||
len = strlen(phonemes);
|
||||
p_end = &phonemes[len-1];
|
||||
|
||||
switch(tr->translator_name)
|
||||
{
|
||||
#ifdef deleted
|
||||
// this is now done in de_rules
|
||||
case L('d','e'):
|
||||
if(p_end[0] == PhonemeCode2('i',':'))
|
||||
{
|
||||
// words ends in ['i:], change to [=I@]
|
||||
p_end[-1] = phonSTRESS_PREV;
|
||||
p_end[0] = PhonemeCode('I');
|
||||
p_end[1] = phonSCHWA;
|
||||
p_end[2] = 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case L('r','o'):
|
||||
if(p_end[0] == PhonemeCode('j'))
|
||||
{
|
||||
// word end in [j], change to ['i]
|
||||
p_end[0] = phonSTRESS_P;
|
||||
p_end[1] = PhonemeCode('i');
|
||||
p_end[2] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // end of ApplySpecialAttribute
|
||||
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
@@ -3045,6 +3003,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
const char *word1;
|
||||
int wflags = 0;
|
||||
char word_buf[N_WORD_BYTES+1];
|
||||
char dict_flags_buf[80];
|
||||
|
||||
if(wtab != NULL)
|
||||
{
|
||||
@@ -3265,6 +3224,11 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
if(tr->expect_verb || (tr->expect_verb_s && (end_flags & FLAG_SUFX_S)))
|
||||
{
|
||||
// OK, we are expecting a verb
|
||||
if((tr->translator_name == L('e','n')) && (tr->prev_dict_flags[0] & FLAG_ALT6_TRANS) && (end_flags & FLAG_SUFX_S))
|
||||
{
|
||||
// lang=en, don't use verb form after 'to' if the word has 's' suffix
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3294,7 +3258,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
if(dictionary_flags & FLAG_ALT2_TRANS)
|
||||
{
|
||||
// language specific
|
||||
if((tr->translator_name == L('h','u')) && !(tr->prev_dict_flags & FLAG_ALT_TRANS))
|
||||
if((tr->translator_name == L('h','u')) && !(tr->prev_dict_flags[0] & FLAG_ALT_TRANS))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3308,7 +3272,8 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
{
|
||||
if(option_phonemes == 2)
|
||||
{
|
||||
fprintf(f_trans,"Flags: %s %s\n",word1,print_dictionary_flags(flags));
|
||||
print_dictionary_flags(flags, dict_flags_buf, sizeof(dict_flags_buf));
|
||||
fprintf(f_trans,"Flags: %s %s\n", word1, dict_flags_buf);
|
||||
}
|
||||
return(0); // no phoneme translation found here, only flags. So use rules
|
||||
}
|
||||
@@ -3331,19 +3296,20 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
if(textmode == translator->langopts.textmode)
|
||||
{
|
||||
// only show this line if the word translates to phonemes, not replacement text
|
||||
if((dictionary_skipwords) && (wtab != NULL))
|
||||
if((dictionary_flags & FLAG_SKIPWORDS) && (wtab != NULL))
|
||||
{
|
||||
// matched more than one word
|
||||
// (check for wtab prevents showing RULE_SPELLING byte when speaking individual letters)
|
||||
memcpy(word_buf,word2,word_end-word2);
|
||||
word_buf[word_end-word2-1] = 0;
|
||||
fprintf(f_trans,"Found: '%s %s",word1,word_buf);
|
||||
fprintf(f_trans,"Found: '%s %s\n",word1,word_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(f_trans,"Found: '%s",word1);
|
||||
}
|
||||
fprintf(f_trans,"' [%s] %s\n",ph_decoded,print_dictionary_flags(flags));
|
||||
print_dictionary_flags(flags, dict_flags_buf, sizeof(dict_flags_buf));
|
||||
fprintf(f_trans,"' [%s] %s\n", ph_decoded,dict_flags_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+23
-23
@@ -46,14 +46,14 @@ t_espeak_command* create_espeak_text(const void *text, size_t size, unsigned int
|
||||
{
|
||||
goto text_error;
|
||||
}
|
||||
|
||||
a_text = malloc( size );
|
||||
|
||||
a_text = malloc( size+1 );
|
||||
if (!a_text)
|
||||
{
|
||||
goto text_error;
|
||||
}
|
||||
memcpy(a_text, text, size);
|
||||
|
||||
|
||||
a_command->type = ET_TEXT;
|
||||
a_command->state = CS_UNDEFINED;
|
||||
data = &(a_command->u.my_text);
|
||||
@@ -102,7 +102,7 @@ t_espeak_command* create_espeak_terminated_msg(unsigned int unique_identifier, v
|
||||
{
|
||||
goto msg_error;
|
||||
}
|
||||
|
||||
|
||||
a_command->type = ET_TERMINATED_MSG;
|
||||
a_command->state = CS_UNDEFINED;
|
||||
data = &(a_command->u.my_terminated_msg);
|
||||
@@ -234,7 +234,7 @@ t_espeak_command* create_espeak_char(wchar_t character, void* user_data)
|
||||
{
|
||||
goto char_error;
|
||||
}
|
||||
|
||||
|
||||
a_command->type = ET_CHAR;
|
||||
a_command->state = CS_UNDEFINED;
|
||||
a_command->u.my_char.user_data = user_data;
|
||||
@@ -270,11 +270,11 @@ t_espeak_command* create_espeak_parameter(espeak_PARAMETER parameter, int value,
|
||||
{
|
||||
goto param_error;
|
||||
}
|
||||
|
||||
|
||||
a_command->type = ET_PARAMETER;
|
||||
a_command->state = CS_UNDEFINED;
|
||||
data = &(a_command->u.my_param);
|
||||
data->parameter = parameter;
|
||||
data->parameter = parameter;
|
||||
data->value = value;
|
||||
data->relative = relative;
|
||||
a_error=0;
|
||||
@@ -308,7 +308,7 @@ t_espeak_command* create_espeak_punctuation_list(const wchar_t *punctlist)
|
||||
{
|
||||
goto list_error;
|
||||
}
|
||||
|
||||
|
||||
a_command->type = ET_PUNCTUATION_LIST;
|
||||
a_command->state = CS_UNDEFINED;
|
||||
|
||||
@@ -350,7 +350,7 @@ t_espeak_command* create_espeak_voice_name(const char *name)
|
||||
{
|
||||
goto name_error;
|
||||
}
|
||||
|
||||
|
||||
a_command->type = ET_VOICE_NAME;
|
||||
a_command->state = CS_UNDEFINED;
|
||||
a_command->u.my_voice_name = strdup( name);
|
||||
@@ -381,7 +381,7 @@ t_espeak_command* create_espeak_voice_spec(espeak_VOICE *voice)
|
||||
{
|
||||
goto spec_error;
|
||||
}
|
||||
|
||||
|
||||
a_command->type = ET_VOICE_SPEC;
|
||||
a_command->state = CS_UNDEFINED;
|
||||
{
|
||||
@@ -451,11 +451,11 @@ int delete_espeak_command( t_espeak_command* the_command)
|
||||
break;
|
||||
|
||||
case ET_TERMINATED_MSG:
|
||||
{
|
||||
{
|
||||
// if the terminated msg is pending,
|
||||
// it must be processed here for informing the calling program
|
||||
// it must be processed here for informing the calling program
|
||||
// that its message is finished.
|
||||
// This can be important for cleaning the related user data.
|
||||
// This can be important for cleaning the related user data.
|
||||
t_espeak_terminated_msg* data = &(the_command->u.my_terminated_msg);
|
||||
if (the_command->state == CS_PENDING)
|
||||
{
|
||||
@@ -491,7 +491,7 @@ int delete_espeak_command( t_espeak_command* the_command)
|
||||
free((void*)(the_command->u.my_voice_name));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ET_VOICE_SPEC:
|
||||
{
|
||||
espeak_VOICE* data = &(the_command->u.my_voice_spec);
|
||||
@@ -542,23 +542,23 @@ void process_espeak_command( t_espeak_command* the_command)
|
||||
case ET_TEXT:
|
||||
{
|
||||
t_espeak_text* data = &(the_command->u.my_text);
|
||||
sync_espeak_Synth( data->unique_identifier, data->text, data->size,
|
||||
data->position, data->position_type,
|
||||
data->end_position, data->flags, data->user_data);
|
||||
sync_espeak_Synth( data->unique_identifier, data->text, data->size,
|
||||
data->position, data->position_type,
|
||||
data->end_position, data->flags, data->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case ET_MARK:
|
||||
{
|
||||
t_espeak_mark* data = &(the_command->u.my_mark);
|
||||
sync_espeak_Synth_Mark( data->unique_identifier, data->text, data->size,
|
||||
data->index_mark, data->end_position, data->flags,
|
||||
sync_espeak_Synth_Mark( data->unique_identifier, data->text, data->size,
|
||||
data->index_mark, data->end_position, data->flags,
|
||||
data->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case ET_TERMINATED_MSG:
|
||||
{
|
||||
{
|
||||
t_espeak_terminated_msg* data = &(the_command->u.my_terminated_msg);
|
||||
sync_espeak_terminated_msg( data->unique_identifier, data->user_data);
|
||||
}
|
||||
@@ -654,8 +654,8 @@ void display_espeak_command( t_espeak_command* the_command)
|
||||
{
|
||||
t_espeak_terminated_msg* data = &(the_command->u.my_terminated_msg);
|
||||
|
||||
SHOW("display_espeak_command > (0x%x) TERMINATED_MSG uid=%d, user_data=0x%x, state=%d\n",
|
||||
the_command, data->unique_identifier, data->user_data,
|
||||
SHOW("display_espeak_command > (0x%x) TERMINATED_MSG uid=%d, user_data=0x%x, state=%d\n",
|
||||
the_command, data->unique_identifier, data->user_data,
|
||||
the_command->state);
|
||||
}
|
||||
break;
|
||||
@@ -670,7 +670,7 @@ void display_espeak_command( t_espeak_command* the_command)
|
||||
case ET_PARAMETER:
|
||||
{
|
||||
t_espeak_parameter* data = &(the_command->u.my_param);
|
||||
SHOW("display_espeak_command > (0x%x) PARAMETER=%d, value=%d, relative=%d\n",
|
||||
SHOW("display_espeak_command > (0x%x) PARAMETER=%d, value=%d, relative=%d\n",
|
||||
the_command, data->parameter, data->value, data->relative);
|
||||
}
|
||||
break;
|
||||
|
||||
+4
-22
@@ -631,25 +631,6 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef deleted
|
||||
if((ph_buf[0] == 0) && (tr->translator_name != L('e','n')))
|
||||
{
|
||||
// speak as English, check whether there is a translation for this character
|
||||
SetTranslator2("en");
|
||||
save_option_phonemes = option_phonemes;
|
||||
option_phonemes = 0;
|
||||
LookupLetter(translator2, letter, word[n_bytes], ph_buf, control & 1);
|
||||
SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table
|
||||
option_phonemes = save_option_phonemes;
|
||||
|
||||
if(ph_buf[0] != 0)
|
||||
{
|
||||
sprintf(phonemes,"%cen",phonSWITCH);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
alphabet = AlphabetFromChar(letter);
|
||||
if(alphabet != current_alphabet)
|
||||
{
|
||||
@@ -892,7 +873,7 @@ static int CheckDotOrdinal(Translator *tr, char *word, char *word_end, WORD_TAB
|
||||
nextflags = TranslateWord(tr, &word_end[2], 0, NULL, NULL);
|
||||
}
|
||||
|
||||
if((tr->prev_dict_flags & FLAG_ALT_TRANS) && ((c2 == 0) || (wtab[0].flags & FLAG_COMMA_AFTER) || iswdigit(c2)))
|
||||
if((tr->prev_dict_flags[0] & FLAG_ALT_TRANS) && ((c2 == 0) || (wtab[0].flags & FLAG_COMMA_AFTER) || iswdigit(c2)))
|
||||
ordinal = 0; // TEST 09.02.10
|
||||
|
||||
if(nextflags & FLAG_ALT_TRANS)
|
||||
@@ -903,7 +884,7 @@ if((tr->prev_dict_flags & FLAG_ALT_TRANS) && ((c2 == 0) || (wtab[0].flags & FLAG
|
||||
if(word[-2] == '-')
|
||||
ordinal = 0; // eg. december 2-5. között
|
||||
|
||||
if(tr->prev_dict_flags & (FLAG_ALT_TRANS | FLAG_ALT3_TRANS))
|
||||
if(tr->prev_dict_flags[0] & (FLAG_ALT_TRANS | FLAG_ALT3_TRANS))
|
||||
ordinal = 0x22;
|
||||
}
|
||||
}
|
||||
@@ -1052,7 +1033,8 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
}
|
||||
}
|
||||
|
||||
tr->prev_dict_flags = 0;
|
||||
tr->prev_dict_flags[0] = 0;
|
||||
tr->prev_dict_flags[1] = 0;
|
||||
TranslateNumber(tr, &number_chars[2], p, flags, wtab, num_control);
|
||||
|
||||
if(tr->langopts.numbers & NUM_ROMAN_AFTER)
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.46.41 03.Mar.13";
|
||||
const char *version_string = "1.46.42 06.Mar.13";
|
||||
const int version_phdata = 0x014640;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -73,25 +73,25 @@
|
||||
ALPHABET alphabets [] = {
|
||||
{"_el", OFFSET_GREEK, 0x380, 0x3ff, L('e','l'), AL_DONT_NAME | AL_NOT_LETTERS},
|
||||
{"_cyr", OFFSET_CYRILLIC, 0x400, 0x52f, 0, 0},
|
||||
{"_hy", OFFSET_ARMENIAN, 0x530, 0x58f, L('h','y'), 0},
|
||||
{"_hy", OFFSET_ARMENIAN, 0x530, 0x58f, L('h','y'), AL_WORDS},
|
||||
{"_he", OFFSET_HEBREW, 0x590, 0x5ff, 0, 0},
|
||||
{"_ar", OFFSET_ARABIC, 0x600, 0x6ff, 0, 0},
|
||||
{"_dv", OFFSET_THAANA, 0x780, 0x7bf, 0, 0},
|
||||
{"_hi", OFFSET_DEVANAGARI, 0x900, 0x97f,L('h','i'), 0},
|
||||
{"_hi", OFFSET_DEVANAGARI, 0x900, 0x97f,L('h','i'), AL_WORDS},
|
||||
{"_bn", OFFSET_BENGALI, 0x0980, 0x9ff, 0, 0},
|
||||
{"_gur", OFFSET_GURMUKHI, 0xa00, 0xa7f, 0, 0},
|
||||
{"_gu", OFFSET_GUJARATI, 0xa80, 0xaff, 0, 0},
|
||||
{"_or", OFFSET_ORIYA, 0xb00, 0xb7f, 0, 0},
|
||||
{"_ta", OFFSET_TAMIL, 0xb80, 0xbff, L('t','a'), 0},
|
||||
{"_te", OFFSET_TELUGU, 0xc00, 0xc7f, 0, 0},
|
||||
{"_kn", OFFSET_KANNADA, 0xc80, 0xcff, L('k','n'), 0},
|
||||
{"_ml", OFFSET_MALAYALAM,0xd00, 0xd7f, L('m','l'), 0},
|
||||
{"_ta", OFFSET_TAMIL, 0xb80, 0xbff, L('t','a'), AL_WORDS},
|
||||
{"_te", OFFSET_TELUGU, 0xc00, 0xc7f, L('t','e'), 0},
|
||||
{"_kn", OFFSET_KANNADA, 0xc80, 0xcff, L('k','n'), AL_WORDS},
|
||||
{"_ml", OFFSET_MALAYALAM,0xd00, 0xd7f, L('m','l'), AL_WORDS},
|
||||
{"_si", OFFSET_SINHALA, 0xd80, 0xdff, 0, 0},
|
||||
{"_th", OFFSET_THAI, 0xe00, 0xe7f, 0, 0},
|
||||
{"_lo", OFFSET_LAO, 0xe80, 0xeff, 0, 0},
|
||||
{"_ti", OFFSET_TIBET, 0xf00, 0xfff, 0, 0},
|
||||
{"_my", OFFSET_MYANMAR, 0x1000,0x109f, 0, 0},
|
||||
{"_ka", OFFSET_GEORGIAN, 0x10a0,0x10ff, L('k','a'), 0},
|
||||
{"_ka", OFFSET_GEORGIAN, 0x10a0,0x10ff, L('k','a'), AL_WORDS},
|
||||
{"_ko", OFFSET_KOREAN, 0x1100,0x11ff, 0, 0},
|
||||
{"_eth", OFFSET_ETHIOPIC, 0x1200,0x139f, 0, 0},
|
||||
{NULL, 0, 0, 0, 0, 0}
|
||||
|
||||
+6
-7
@@ -1374,9 +1374,6 @@ if(end_type & SUFX_UNPRON)
|
||||
{
|
||||
// don't retranslate, use the original lookup result
|
||||
strcpy(phonemes,phonemes2);
|
||||
|
||||
// language specific changes
|
||||
ApplySpecialAttribute(tr,phonemes,dictionary_flags[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2059,7 +2056,8 @@ return(FLAG_SPELLWORD);
|
||||
pre_pause--;
|
||||
}
|
||||
tr->end_stressed_vowel = 0; // forget about the previous word
|
||||
tr->prev_dict_flags = 0;
|
||||
tr->prev_dict_flags[0] = 0;
|
||||
tr->prev_dict_flags[1] = 0;
|
||||
}
|
||||
|
||||
if((option_capitals==1) && (word_flags & FLAG_FIRST_UPPER))
|
||||
@@ -2208,7 +2206,7 @@ return(FLAG_SPELLWORD);
|
||||
{
|
||||
if(first_phoneme && tr->langopts.param[LOPT_IT_DOUBLING])
|
||||
{
|
||||
if(((tr->prev_dict_flags & FLAG_DOUBLING) && (tr->langopts.param[LOPT_IT_DOUBLING] & 1)) ||
|
||||
if(((tr->prev_dict_flags[0] & FLAG_DOUBLING) && (tr->langopts.param[LOPT_IT_DOUBLING] & 1)) ||
|
||||
(tr->end_stressed_vowel && (tr->langopts.param[LOPT_IT_DOUBLING] & 2)))
|
||||
{
|
||||
// italian, double the initial consonant if the previous word ends with a
|
||||
@@ -2264,7 +2262,7 @@ return(FLAG_SPELLWORD);
|
||||
ph_list2[max_stress_ix].synthflags |= SFLAG_PROMOTE_STRESS;
|
||||
}
|
||||
|
||||
tr->prev_dict_flags = flags;
|
||||
tr->prev_dict_flags[0] = flags;
|
||||
return(flags);
|
||||
} // end of TranslateWord2
|
||||
|
||||
@@ -2623,7 +2621,8 @@ p = source;
|
||||
tr->expect_verb_s=0;
|
||||
tr->phonemes_repeat_count = 0;
|
||||
tr->end_stressed_vowel=0;
|
||||
tr->prev_dict_flags = 0;
|
||||
tr->prev_dict_flags[0] = 0;
|
||||
tr->prev_dict_flags[1] = 0;
|
||||
|
||||
word_count = 0;
|
||||
single_quoted = 0;
|
||||
|
||||
+7
-6
@@ -48,8 +48,11 @@
|
||||
#define FLAG_ALT_TRANS 0x8000 // language specific
|
||||
#define FLAG_ALT2_TRANS 0x10000 // language specific
|
||||
#define FLAG_ALT3_TRANS 0x20000 // language specific
|
||||
#define FLAG_COMBINE 0x40000 // combine with the next word
|
||||
#define FLAG_ALT4_TRANS 0x40000 // language specific
|
||||
#define FLAG_ALT5_TRANS 0x80000 // language specific
|
||||
#define FLAG_ALT6_TRANS 0x100000 // language specific
|
||||
|
||||
#define FLAG_COMBINE 0x800000 // combine with the next word
|
||||
#define FLAG_ALLOW_DOT 0x01000000 // ignore '.' after word (abbreviation)
|
||||
#define FLAG_NEEDS_DOT 0x02000000 // only if the word is followed by a dot
|
||||
#define FLAG_WAS_UNPRONOUNCABLE 0x04000000 // the unpronounceable routine was used
|
||||
@@ -79,7 +82,7 @@
|
||||
#define FLAG_ONLY_S 0x8000
|
||||
#define FLAG_STEM 0x10000 // must have a suffix
|
||||
#define FLAG_ATEND 0x20000 /* use this pronunciation if at end of clause */
|
||||
#define FLAG_ATSTART 0x30000 // use this pronunciation if at start of clause
|
||||
#define FLAG_ATSTART 0x40000 // use this pronunciation if at start of clause
|
||||
|
||||
#define BITNUM_FLAG_ALLCAPS 0x2a
|
||||
#define BITNUM_FLAG_HYPHENATED 0x2c
|
||||
@@ -272,7 +275,7 @@ extern ALPHABET *current_alphabet;
|
||||
// alphabet flags
|
||||
#define AL_DONT_NAME 0x01 // don't speak the alphabet name
|
||||
#define AL_NOT_LETTERS 0x02 // don't use the language for speaking letters
|
||||
#define AL_NOT_WORDS 0x04 // don't use the language to speak words
|
||||
#define AL_WORDS 0x04 // use the language to speak words
|
||||
|
||||
|
||||
#define N_LOPTS 21
|
||||
@@ -585,7 +588,6 @@ typedef struct
|
||||
unsigned char groups2_start[256]; // index into groups2
|
||||
const short *frequent_pairs; // list of frequent pairs of letters, for use in compressed *_list
|
||||
|
||||
|
||||
int expect_verb;
|
||||
int expect_past; // expect past tense
|
||||
int expect_verb_s;
|
||||
@@ -601,7 +603,7 @@ typedef struct
|
||||
|
||||
int prepause_timeout;
|
||||
int end_stressed_vowel; // word ends with stressed vowel
|
||||
int prev_dict_flags; // dictionary flags from previous word
|
||||
int prev_dict_flags[2]; // dictionary flags from previous word
|
||||
int clause_terminator;
|
||||
} Translator;
|
||||
|
||||
@@ -703,7 +705,6 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
|
||||
void MakePhonemeList(Translator *tr, int post_pause, int new_sentence);
|
||||
int ChangePhonemes_ru(Translator *tr, PHONEME_LIST2 *phlist, int n_ph, int index, PHONEME_TAB *ph, CHANGEPH *ch);
|
||||
void ApplySpecialAttribute(Translator *tr, char *phonemes, int dict_flags);
|
||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags);
|
||||
void AppendPhonemes(Translator *tr, char *string, int size, const char *ph);
|
||||
|
||||
|
||||
+31
-17
@@ -554,12 +554,13 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
const char *language_type;
|
||||
char buf[200];
|
||||
char path_voices[sizeof(path_home)+12];
|
||||
char langname[4];
|
||||
|
||||
int stress_amps[8];
|
||||
int stress_lengths[8];
|
||||
int stress_add[8];
|
||||
char names[8][40];
|
||||
char name2[80];
|
||||
const char *voice_dir;
|
||||
|
||||
int pitch1;
|
||||
int pitch2;
|
||||
@@ -568,6 +569,12 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
static char voice_name[40]; // voice name for current_voice_selected
|
||||
static char voice_languages[100]; // list of languages and priorities for current_voice_selected
|
||||
|
||||
// which directory to look for a named voice
|
||||
static const char *voices_asia =
|
||||
"fa fa-pin hi hy hy-west id ka kn ku ml ne pa ta tr vi vi-hue zh zh-yue ";
|
||||
static const char *voices_europe =
|
||||
"bg bs ca cs cy da el es et fi fr-be hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
|
||||
|
||||
strcpy(voicename,vname);
|
||||
if(voicename[0]==0)
|
||||
strcpy(voicename,"default");
|
||||
@@ -581,27 +588,34 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
else
|
||||
{
|
||||
sprintf(path_voices,"%s%cvoices%c",path_home,PATHSEP,PATHSEP);
|
||||
sprintf(buf,"%s%s",path_voices,voicename);
|
||||
sprintf(buf,"%s%s",path_voices,voicename); // first, look in the main voices directory
|
||||
|
||||
if(GetFileLength(buf) <= 0)
|
||||
{
|
||||
// look for the voice in a sub-directory of the language name
|
||||
langname[0] = voicename[0];
|
||||
langname[1] = voicename[1];
|
||||
langname[2] = 0;
|
||||
sprintf(buf,"%s%s%c%s",path_voices,langname,PATHSEP,voicename);
|
||||
// then look in the appropriate subdirectory
|
||||
if((voicename[0]=='m') && (voicename[1]=='b'))
|
||||
{
|
||||
voice_dir = "mb"; // mbrola voices
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(name2, "%s ", voicename);
|
||||
if(strstr(voices_europe, voicename) != NULL)
|
||||
voice_dir = "europe";
|
||||
else
|
||||
if(strstr(voices_asia, voicename) != NULL)
|
||||
voice_dir = "asia";
|
||||
else
|
||||
voice_dir = "other";
|
||||
|
||||
if(GetFileLength(buf) <= 0)
|
||||
{
|
||||
// look in "extra" sub-directory
|
||||
sprintf(buf,"%sextra%c%s",path_voices,PATHSEP,voicename);
|
||||
sprintf(buf,"%s%s%c%s", path_voices,voice_dir,PATHSEP,voicename);
|
||||
|
||||
if(GetFileLength(buf) <= 0)
|
||||
{
|
||||
// look in "test" sub-directory
|
||||
sprintf(buf,"%stest%c%s",path_voices,PATHSEP,voicename);
|
||||
}
|
||||
}
|
||||
if(GetFileLength(buf) <= 0)
|
||||
{
|
||||
// if not found, look in "test" sub-directory
|
||||
sprintf(buf,"%stest%c%s",path_voices,PATHSEP,voicename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1195,7 +1195,7 @@ void *wave_test_get_write_buffer()
|
||||
// notdef USE_PORTAUDIO
|
||||
|
||||
|
||||
int wave_init(int srate) {}
|
||||
int wave_init(int srate) {return 1;}
|
||||
void* wave_open(const char* the_api) {return (void *)1;}
|
||||
size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSize) {return theSize;}
|
||||
int wave_close(void* theHandler) {return 0;}
|
||||
|
||||
+1
-1
@@ -870,7 +870,7 @@ void *wave_test_get_write_buffer()
|
||||
// notdef USE_PULSEAUDIO
|
||||
|
||||
|
||||
int wave_init() {}
|
||||
int wave_init(return 1;) {}
|
||||
void* wave_open(const char* the_api) {return (void *)1;}
|
||||
size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSize) {return theSize;}
|
||||
int wave_close(void* theHandler) {return 0;}
|
||||
|
||||
+1
-1
@@ -535,7 +535,7 @@ int wave_get_remaining_time(uint32_t sample, uint32_t* time)
|
||||
#else
|
||||
// notdef USE_SADA
|
||||
|
||||
init wave_init() {}
|
||||
init wave_init() {return 1;}
|
||||
void* wave_open(const char* the_api) {return (void *)1;}
|
||||
size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSize) {return theSize;}
|
||||
int wave_close(void* theHandler) {return 0;}
|
||||
|
||||
Reference in New Issue
Block a user