- param2[] is only used to set a second value to LOPT_BRACKET_PAUSE. It is simpler to have two values in param[] instead. This simplifies the codebase. - Instead of setting "option bracket X Y" in language files, use keywords "brackets X" and "bracketsAnnounced Y" instead to follow the naming convention of other keywords. - Add missing documentation to docs/voices.md.master
@@ -21,6 +21,8 @@ | |||
- [speed](#speed) | |||
- [words](#words) | |||
- [Language Attributes](#language-attributes) | |||
- [brackets](#brackets) | |||
- [bracketsAnnounced](#bracketsAnnounced) | |||
- [phonemes](#phonemes) | |||
- [dictionary](#dictionary) | |||
- [dictrules](#dictrules) | |||
@@ -335,6 +337,22 @@ vowel and the next start with a vowel. | |||
## Language Attributes | |||
### brackets | |||
brackets <value> | |||
Default value: 4 | |||
Increases the pause when reading brackets. Example: "Pause (with brackets)". | |||
### bracketsAnnounced | |||
bracketsAnnounced <value> | |||
Default value: 2 | |||
Increases the pause when reading brackets when --punct is set to read bracket names. Example: "Pause (with brackets)". | |||
### phonemes | |||
phonemes <name> |
@@ -1,6 +1,7 @@ | |||
name Hungarian | |||
language hu | |||
option bracket 0 0 | |||
brackets 0 | |||
bracketsAnnounced 0 | |||
pitch 81 117 | |||
@@ -2309,9 +2309,9 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c | |||
// is it a bracket ? | |||
if (letter == 0xe000+'(') { | |||
if (pre_pause < tr->langopts.param2[LOPT_BRACKET_PAUSE]) | |||
pre_pause = tr->langopts.param2[LOPT_BRACKET_PAUSE]; // a bracket, already spoken by AnnouncePunctuation() | |||
} | |||
if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED]) | |||
pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED]; // a bracket, already spoken by AnnouncePunctuation() | |||
} | |||
if (IsBracket(letter)) { | |||
if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE]) | |||
pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE]; |
@@ -291,7 +291,7 @@ static Translator *NewTranslator(void) | |||
tr->langopts.param[LOPT_MAXAMP_EOC] = 19; | |||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 's'; // don't count this character at start of word | |||
tr->langopts.param[LOPT_BRACKET_PAUSE] = 4; // pause at bracket | |||
tr->langopts.param2[LOPT_BRACKET_PAUSE] = 2; // pauses when announcing bracket names | |||
tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED] = 2; // pauses when announcing bracket names | |||
tr->langopts.max_initial_consonants = 3; | |||
tr->langopts.replace_chars = NULL; | |||
tr->langopts.alt_alphabet_lang = L('e', 'n'); |
@@ -285,7 +285,7 @@ typedef struct { | |||
#define AL_NOT_CODE 0x08 // don't speak the character code | |||
#define AL_NO_SYMBOL 0x10 // don't repeat "symbol" or "character" | |||
#define N_LOPTS 21 | |||
#define N_LOPTS 22 | |||
#define LOPT_DIERESES 1 | |||
// 1=remove [:] from unstressed syllables, 2= remove from unstressed or non-penultimate syllables | |||
// bit 4=0, if stress < 4, bit 4=1, if not the highest stress in the word | |||
@@ -339,7 +339,7 @@ typedef struct { | |||
// bit 1: stressed syllable: $alt change [e],[o] to [E],[O], $alt2 change [E],[O] to [e],[o] | |||
#define LOPT_ALT 15 | |||
// pause for bracket (default=4), pause when announcing bracket names (default=2) | |||
// pause for bracket (default=4), also see LOPT_BRACKET_PAUSE_ANNOUNCED | |||
#define LOPT_BRACKET_PAUSE 16 | |||
// bit 1, don't break clause before annoucning . ? ! | |||
@@ -355,6 +355,9 @@ typedef struct { | |||
// bit 1 Apostrophe at end of word is part of the word | |||
#define LOPT_APOSTROPHE 20 | |||
// pause when announcing bracket names (default=2), also see LOPT_BRACKET_PAUSE | |||
#define LOPT_BRACKET_PAUSE_ANNOUNCED 21 | |||
// stress_rule | |||
#define STRESSPOSN_1L 0 // 1st syllable | |||
#define STRESSPOSN_2L 1 // 2nd syllable | |||
@@ -428,7 +431,6 @@ typedef struct { | |||
int unstressed_wd1; // stress for $u word of 1 syllable | |||
int unstressed_wd2; // stress for $u word of >1 syllable | |||
int param[N_LOPTS]; | |||
int param2[N_LOPTS]; | |||
unsigned char *length_mods; | |||
unsigned char *length_mods0; | |||
@@ -102,7 +102,6 @@ enum { | |||
V_STRESSRULE, | |||
V_STRESSOPT, | |||
V_NUMBERS, | |||
V_OPTION, | |||
V_MBROLA, | |||
V_KLATT, | |||
@@ -116,11 +115,6 @@ enum { | |||
V_CONSONANTS | |||
}; | |||
static MNEM_TAB options_tab[] = { | |||
{ "bracket", LOPT_BRACKET_PAUSE }, | |||
{ NULL, -1 } | |||
}; | |||
static MNEM_TAB keyword_tab[] = { | |||
{ "name", V_NAME }, | |||
{ "language", V_LANGUAGE }, | |||
@@ -154,7 +148,6 @@ static MNEM_TAB keyword_tab[] = { | |||
{ "breath", V_BREATH }, | |||
{ "breathw", V_BREATHW }, | |||
{ "numbers", V_NUMBERS }, | |||
{ "option", V_OPTION }, | |||
{ "mbrola", V_MBROLA }, | |||
{ "consonants", V_CONSONANTS }, | |||
{ "klatt", V_KLATT }, | |||
@@ -170,6 +163,8 @@ static MNEM_TAB keyword_tab[] = { | |||
{ "l_sonorant_min", 0x100+LOPT_SONORANT_MIN }, | |||
{ "l_length_mods", 0x100+LOPT_LENGTH_MODS }, | |||
{ "apostrophe", 0x100+LOPT_APOSTROPHE }, | |||
{ "brackets", 0x100+LOPT_BRACKET_PAUSE }, | |||
{ "bracketsAnnounced", 0x100+LOPT_BRACKET_PAUSE_ANNOUNCED }, | |||
{ NULL, 0 } | |||
}; | |||
@@ -490,7 +485,6 @@ voice_t *LoadVoice(const char *vname, int control) | |||
int ix; | |||
int n; | |||
int value; | |||
int value2; | |||
int langix = 0; | |||
int tone_only = control & 2; | |||
bool language_set = false; | |||
@@ -508,7 +502,6 @@ voice_t *LoadVoice(const char *vname, int control) | |||
char translator_name[40]; | |||
char new_dictionary[40]; | |||
char phonemes_name[40]; | |||
char option_name[40]; | |||
const char *language_type; | |||
char buf[sizeof(path_home)+30]; | |||
char path_voices[sizeof(path_home)+12]; | |||
@@ -771,18 +764,6 @@ voice_t *LoadVoice(const char *vname, int control) | |||
else | |||
fprintf(stderr, "Cannot set stressrule: language not set, or is invalid.\n"); | |||
break; | |||
case V_OPTION: | |||
if (langopts) { | |||
value2 = 0; | |||
if (((sscanf(p, "%s %d %d", option_name, &value, &value2) >= 2) && ((ix = LookupMnem(options_tab, option_name)) >= 0)) || | |||
((sscanf(p, "%d %d %d", &ix, &value, &value2) >= 2) && (ix < N_LOPTS))) { | |||
langopts->param[ix] = value; | |||
langopts->param2[ix] = value2; | |||
} else | |||
fprintf(stderr, "Bad voice option: %s %s\n", buf, p); | |||
} else | |||
fprintf(stderr, "Cannot set option: language not set, or is invalid.\n"); | |||
break; | |||
case V_ECHO: | |||
// echo. suggest: 135mS 11% | |||
value = 0; |