From 23a4d88f6bc3afab1c04c7ffd5d1c2cd2b16493c Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sun, 7 Mar 2021 11:04:50 +0200 Subject: [PATCH] code cleanup: remove unnecessary voice option translator Option "language "already causes SelectTranslator() to be called. Having two options to do almost the same thing is unnecessary and confusing. In the long term, all options from SelectTranslator() should have a switch case in LoadVoice() so they are user configurable (see #218). If needed, a new option (maybe called "LoadOptions") could be added to load an existing voice or language file. Changes language configuration files for: hak, cmn, yue, ltg, ms, mb-ma1. No changes to users. --- espeak-ng-data/lang/bat/ltg | 1 - espeak-ng-data/lang/poz/ms | 2 -- espeak-ng-data/lang/sit/cmn | 1 - espeak-ng-data/lang/sit/hak | 1 - espeak-ng-data/lang/sit/yue | 1 - espeak-ng-data/voices/mb/mb-ma1 | 1 - src/libespeak-ng/tr_languages.c | 1 + src/libespeak-ng/voices.c | 13 ------------- 8 files changed, 1 insertion(+), 20 deletions(-) diff --git a/espeak-ng-data/lang/bat/ltg b/espeak-ng-data/lang/bat/ltg index 127234cb..021faa8a 100644 --- a/espeak-ng-data/lang/bat/ltg +++ b/espeak-ng-data/lang/bat/ltg @@ -2,7 +2,6 @@ name Latgalian language ltg maintainer Valdis Vitolins status testing -translator lv // Reuse pronunciation rules from Latvian phonemes lv dictionary lv dictrules 2 // Setting for Latgalian pronunciation diff --git a/espeak-ng-data/lang/poz/ms b/espeak-ng-data/lang/poz/ms index a90a18b1..27a2712a 100644 --- a/espeak-ng-data/lang/poz/ms +++ b/espeak-ng-data/lang/poz/ms @@ -3,8 +3,6 @@ name Malay language ms phonemes id -translator id - stressLength 160 200 180 180 0 0 220 240 stressAmp 16 18 18 18 0 0 22 21 intonation 3 // Less intonation, and comma does not raise the pitch. diff --git a/espeak-ng-data/lang/sit/cmn b/espeak-ng-data/lang/sit/cmn index 07a77a72..7b7cfa26 100644 --- a/espeak-ng-data/lang/sit/cmn +++ b/espeak-ng-data/lang/sit/cmn @@ -3,7 +3,6 @@ language cmn language zh-cmn language zh -translator zh phonemes zh dictionary zh words 1 diff --git a/espeak-ng-data/lang/sit/hak b/espeak-ng-data/lang/sit/hak index 369a2739..0c3bf14c 100644 --- a/espeak-ng-data/lang/sit/hak +++ b/espeak-ng-data/lang/sit/hak @@ -2,6 +2,5 @@ name Hakka Chinese language hak maintainer Chen Chien-ting status testing -translator hak phonemes hak dictionary hak diff --git a/espeak-ng-data/lang/sit/yue b/espeak-ng-data/lang/sit/yue index 462dcd6f..c4c0c58d 100644 --- a/espeak-ng-data/lang/sit/yue +++ b/espeak-ng-data/lang/sit/yue @@ -3,7 +3,6 @@ language yue language zh-yue language zh 8 -translator zhy phonemes zhy dictionary zhy diff --git a/espeak-ng-data/voices/mb/mb-ma1 b/espeak-ng-data/voices/mb/mb-ma1 index 59135395..fe62fbd4 100644 --- a/espeak-ng-data/voices/mb/mb-ma1 +++ b/espeak-ng-data/voices/mb/mb-ma1 @@ -3,6 +3,5 @@ language ms 1 gender female pitch 140 260 phonemes id -translator id mbrola ma1 ma1_phtrans diff --git a/src/libespeak-ng/tr_languages.c b/src/libespeak-ng/tr_languages.c index 6bda0293..d6751036 100644 --- a/src/libespeak-ng/tr_languages.c +++ b/src/libespeak-ng/tr_languages.c @@ -1169,6 +1169,7 @@ Translator *SelectTranslator(const char *name) } break; case L('l', 'v'): // latvian + case L3('l', 't', 'g'): // latgalian { static const unsigned char stress_amps_lv[8] = { 14, 10, 10, 8, 0, 0, 20, 15 }; static const short stress_lengths_lv[8] = { 180, 180, 180, 160, 0, 0, 230, 180 }; diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index 3d64a18c..095240a4 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -72,7 +72,6 @@ enum { V_NAME = 1, V_LANGUAGE, V_GENDER, - V_TRANSLATOR, V_PHONEMES, V_DICTIONARY, V_VARIANTS, @@ -127,7 +126,6 @@ static MNEM_TAB keyword_tab[] = { { "formant", V_FORMANT }, { "pitch", V_PITCH }, { "phonemes", V_PHONEMES }, - { "translator", V_TRANSLATOR }, { "dictionary", V_DICTIONARY }, { "stressLength", V_STRESSLENGTH }, { "stressAmp", V_STRESSAMP }, @@ -649,17 +647,6 @@ voice_t *LoadVoice(const char *vname, int control) current_voice_selected.age = age; } break; - case V_TRANSLATOR: - if (tone_only) break; - - sscanf(p, "%s", translator_name); - - if (new_translator != NULL) - DeleteTranslator(new_translator); - - new_translator = SelectTranslator(translator_name); - langopts = &new_translator->langopts; - break; case V_DICTIONARY: // dictionary sscanf(p, "%s", new_dictionary); break;