- 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
| - [speed](#speed) | - [speed](#speed) | ||||
| - [words](#words) | - [words](#words) | ||||
| - [Language Attributes](#language-attributes) | - [Language Attributes](#language-attributes) | ||||
| - [brackets](#brackets) | |||||
| - [bracketsAnnounced](#bracketsAnnounced) | |||||
| - [phonemes](#phonemes) | - [phonemes](#phonemes) | ||||
| - [dictionary](#dictionary) | - [dictionary](#dictionary) | ||||
| - [dictrules](#dictrules) | - [dictrules](#dictrules) | ||||
| ## Language Attributes | ## 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 | ||||
| phonemes <name> | phonemes <name> |
| name Hungarian | name Hungarian | ||||
| language hu | language hu | ||||
| option bracket 0 0 | |||||
| brackets 0 | |||||
| bracketsAnnounced 0 | |||||
| pitch 81 117 | pitch 81 117 | ||||
| // is it a bracket ? | // is it a bracket ? | ||||
| if (letter == 0xe000+'(') { | 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 (IsBracket(letter)) { | ||||
| if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE]) | if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE]) | ||||
| pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE]; | pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE]; |
| tr->langopts.param[LOPT_MAXAMP_EOC] = 19; | 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_UNPRONOUNCABLE] = 's'; // don't count this character at start of word | ||||
| tr->langopts.param[LOPT_BRACKET_PAUSE] = 4; // pause at bracket | 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.max_initial_consonants = 3; | ||||
| tr->langopts.replace_chars = NULL; | tr->langopts.replace_chars = NULL; | ||||
| tr->langopts.alt_alphabet_lang = L('e', 'n'); | tr->langopts.alt_alphabet_lang = L('e', 'n'); |
| #define AL_NOT_CODE 0x08 // don't speak the character code | #define AL_NOT_CODE 0x08 // don't speak the character code | ||||
| #define AL_NO_SYMBOL 0x10 // don't repeat "symbol" or "character" | #define AL_NO_SYMBOL 0x10 // don't repeat "symbol" or "character" | ||||
| #define N_LOPTS 21 | |||||
| #define N_LOPTS 22 | |||||
| #define LOPT_DIERESES 1 | #define LOPT_DIERESES 1 | ||||
| // 1=remove [:] from unstressed syllables, 2= remove from unstressed or non-penultimate syllables | // 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 | // bit 4=0, if stress < 4, bit 4=1, if not the highest stress in the word | ||||
| // bit 1: stressed syllable: $alt change [e],[o] to [E],[O], $alt2 change [E],[O] to [e],[o] | // bit 1: stressed syllable: $alt change [e],[o] to [E],[O], $alt2 change [E],[O] to [e],[o] | ||||
| #define LOPT_ALT 15 | #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 | #define LOPT_BRACKET_PAUSE 16 | ||||
| // bit 1, don't break clause before annoucning . ? ! | // bit 1, don't break clause before annoucning . ? ! | ||||
| // bit 1 Apostrophe at end of word is part of the word | // bit 1 Apostrophe at end of word is part of the word | ||||
| #define LOPT_APOSTROPHE 20 | #define LOPT_APOSTROPHE 20 | ||||
| // pause when announcing bracket names (default=2), also see LOPT_BRACKET_PAUSE | |||||
| #define LOPT_BRACKET_PAUSE_ANNOUNCED 21 | |||||
| // stress_rule | // stress_rule | ||||
| #define STRESSPOSN_1L 0 // 1st syllable | #define STRESSPOSN_1L 0 // 1st syllable | ||||
| #define STRESSPOSN_2L 1 // 2nd syllable | #define STRESSPOSN_2L 1 // 2nd syllable | ||||
| int unstressed_wd1; // stress for $u word of 1 syllable | int unstressed_wd1; // stress for $u word of 1 syllable | ||||
| int unstressed_wd2; // stress for $u word of >1 syllable | int unstressed_wd2; // stress for $u word of >1 syllable | ||||
| int param[N_LOPTS]; | int param[N_LOPTS]; | ||||
| int param2[N_LOPTS]; | |||||
| unsigned char *length_mods; | unsigned char *length_mods; | ||||
| unsigned char *length_mods0; | unsigned char *length_mods0; | ||||
| V_STRESSRULE, | V_STRESSRULE, | ||||
| V_STRESSOPT, | V_STRESSOPT, | ||||
| V_NUMBERS, | V_NUMBERS, | ||||
| V_OPTION, | |||||
| V_MBROLA, | V_MBROLA, | ||||
| V_KLATT, | V_KLATT, | ||||
| V_CONSONANTS | V_CONSONANTS | ||||
| }; | }; | ||||
| static MNEM_TAB options_tab[] = { | |||||
| { "bracket", LOPT_BRACKET_PAUSE }, | |||||
| { NULL, -1 } | |||||
| }; | |||||
| static MNEM_TAB keyword_tab[] = { | static MNEM_TAB keyword_tab[] = { | ||||
| { "name", V_NAME }, | { "name", V_NAME }, | ||||
| { "language", V_LANGUAGE }, | { "language", V_LANGUAGE }, | ||||
| { "breath", V_BREATH }, | { "breath", V_BREATH }, | ||||
| { "breathw", V_BREATHW }, | { "breathw", V_BREATHW }, | ||||
| { "numbers", V_NUMBERS }, | { "numbers", V_NUMBERS }, | ||||
| { "option", V_OPTION }, | |||||
| { "mbrola", V_MBROLA }, | { "mbrola", V_MBROLA }, | ||||
| { "consonants", V_CONSONANTS }, | { "consonants", V_CONSONANTS }, | ||||
| { "klatt", V_KLATT }, | { "klatt", V_KLATT }, | ||||
| { "l_sonorant_min", 0x100+LOPT_SONORANT_MIN }, | { "l_sonorant_min", 0x100+LOPT_SONORANT_MIN }, | ||||
| { "l_length_mods", 0x100+LOPT_LENGTH_MODS }, | { "l_length_mods", 0x100+LOPT_LENGTH_MODS }, | ||||
| { "apostrophe", 0x100+LOPT_APOSTROPHE }, | { "apostrophe", 0x100+LOPT_APOSTROPHE }, | ||||
| { "brackets", 0x100+LOPT_BRACKET_PAUSE }, | |||||
| { "bracketsAnnounced", 0x100+LOPT_BRACKET_PAUSE_ANNOUNCED }, | |||||
| { NULL, 0 } | { NULL, 0 } | ||||
| }; | }; | ||||
| int ix; | int ix; | ||||
| int n; | int n; | ||||
| int value; | int value; | ||||
| int value2; | |||||
| int langix = 0; | int langix = 0; | ||||
| int tone_only = control & 2; | int tone_only = control & 2; | ||||
| bool language_set = false; | bool language_set = false; | ||||
| char translator_name[40]; | char translator_name[40]; | ||||
| char new_dictionary[40]; | char new_dictionary[40]; | ||||
| char phonemes_name[40]; | char phonemes_name[40]; | ||||
| char option_name[40]; | |||||
| const char *language_type; | const char *language_type; | ||||
| char buf[sizeof(path_home)+30]; | char buf[sizeof(path_home)+30]; | ||||
| char path_voices[sizeof(path_home)+12]; | char path_voices[sizeof(path_home)+12]; | ||||
| else | else | ||||
| fprintf(stderr, "Cannot set stressrule: language not set, or is invalid.\n"); | fprintf(stderr, "Cannot set stressrule: language not set, or is invalid.\n"); | ||||
| break; | 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: | case V_ECHO: | ||||
| // echo. suggest: 135mS 11% | // echo. suggest: 135mS 11% | ||||
| value = 0; | value = 0; |