cleanup: move shared enums and MNEM_TABs to header file

This commit is contained in:
Juho Hiltunen
2022-10-09 16:38:53 +03:00
parent 78c6873427
commit eae4595dc9
3 changed files with 105 additions and 153 deletions
+1 -48
View File
@@ -35,58 +35,11 @@
#include "mnemonics.h" // for MNEM_TAB
#include "translate.h" // for Translator
#include "synthdata.h" // for n_tunes, tunes
#include "voice.h" // for ReadNumbers, Read8Numbers
#include "voice.h" // for ReadNumbers, Read8Numbers, ...
static int CheckTranslator(Translator *tr, const MNEM_TAB *keyword_tab, int key);
static int LookupTune(const char *name);
enum {
V_NAME = 1,
V_LANGUAGE,
V_GENDER,
V_PHONEMES,
V_DICTIONARY,
V_VARIANTS,
V_MAINTAINER,
V_STATUS,
// these affect voice quality, are independent of language
V_FORMANT,
V_PITCH,
V_ECHO,
V_FLUTTER,
V_ROUGHNESS,
V_CLARITY,
V_TONE,
V_VOICING,
V_BREATH,
V_BREATHW,
// these override defaults set by the translator
V_LOWERCASE_SENTENCE,
V_WORDGAP,
V_INTONATION,
V_TUNES,
V_STRESSLENGTH,
V_STRESSAMP,
V_STRESSADD,
V_DICTRULES,
V_STRESSRULE,
V_STRESSOPT,
V_NUMBERS,
V_MBROLA,
V_KLATT,
V_FAST,
V_SPEED,
V_DICTMIN,
// these need a phoneme table to have been specified
V_REPLACE,
V_CONSONANTS
};
extern const MNEM_TAB langopts_tab[];
void LoadLanguageOptions(Translator *translator, int key, char *keyValue ) {
+104
View File
@@ -84,6 +84,110 @@ extern espeak_VOICE current_voice_selected;
extern voice_t *voice;
extern int tone_points[12];
typedef enum {
V_NAME = 1,
V_LANGUAGE,
V_GENDER,
V_PHONEMES,
V_DICTIONARY,
V_VARIANTS,
V_MAINTAINER,
V_STATUS,
// these affect voice quality, are independent of language
V_FORMANT,
V_PITCH,
V_ECHO,
V_FLUTTER,
V_ROUGHNESS,
V_CLARITY,
V_TONE,
V_VOICING,
V_BREATH,
V_BREATHW,
// these override defaults set by the translator
V_LOWERCASE_SENTENCE,
V_WORDGAP,
V_INTONATION,
V_TUNES,
V_STRESSLENGTH,
V_STRESSAMP,
V_STRESSADD,
V_DICTRULES,
V_STRESSRULE,
V_STRESSOPT,
V_NUMBERS,
V_MBROLA,
V_KLATT,
V_FAST,
V_SPEED,
V_DICTMIN,
// these need a phoneme table to have been specified
V_REPLACE,
V_CONSONANTS
} VOICELANGATTRIBUTES;
static const MNEM_TAB langopts_tab[] = {
{ "dictrules", V_DICTRULES },
{ "intonation", V_INTONATION },
{ "l_dieresis", 0x100+LOPT_DIERESES },
{ "l_prefix", 0x100+LOPT_PREFIXES },
{ "l_regressive_v", 0x100+LOPT_REGRESSIVE_VOICING },
{ "l_unpronouncable", 0x100+LOPT_UNPRONOUNCABLE },
{ "l_sonorant_min", 0x100+LOPT_SONORANT_MIN },
{ "lowercaseSentence", V_LOWERCASE_SENTENCE },
{ "numbers", V_NUMBERS },
{ "stressAdd", V_STRESSADD },
{ "stressAmp", V_STRESSAMP },
{ "stressLength", V_STRESSLENGTH },
{ "stressOpt", V_STRESSOPT },
{ "stressRule", V_STRESSRULE },
{ "tunes", V_TUNES },
{ "words", V_WORDGAP },
{ "maintainer", V_MAINTAINER },
{ "status", V_STATUS },
{ NULL, 0 }
};
static const MNEM_TAB keyword_tab[] = {
{ "name", V_NAME },
{ "language", V_LANGUAGE },
{ "gender", V_GENDER },
{ "variants", V_VARIANTS },
{ "formant", V_FORMANT },
{ "pitch", V_PITCH },
{ "phonemes", V_PHONEMES },
{ "dictionary", V_DICTIONARY },
{ "replace", V_REPLACE },
{ "echo", V_ECHO },
{ "flutter", V_FLUTTER },
{ "roughness", V_ROUGHNESS },
{ "clarity", V_CLARITY },
{ "tone", V_TONE },
{ "voicing", V_VOICING },
{ "breath", V_BREATH },
{ "breathw", V_BREATHW },
{ "mbrola", V_MBROLA },
{ "consonants", V_CONSONANTS },
{ "klatt", V_KLATT },
{ "fast_test2", V_FAST },
{ "speed", V_SPEED },
{ "dict_min", V_DICTMIN },
{ "apostrophe", 0x100+LOPT_APOSTROPHE },
{ "brackets", 0x100+LOPT_BRACKET_PAUSE },
{ "bracketsAnnounced", 0x100+LOPT_BRACKET_PAUSE_ANNOUNCED },
{ NULL, 0 }
};
const char *SelectVoice(espeak_VOICE *voice_select, int *found);
espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name);
voice_t *LoadVoice(const char *voice_name, int control);
-105
View File
@@ -73,111 +73,6 @@ static espeak_VOICE *voices_list[N_VOICES_LIST];
espeak_VOICE current_voice_selected;
enum {
V_NAME = 1,
V_LANGUAGE,
V_GENDER,
V_PHONEMES,
V_DICTIONARY,
V_VARIANTS,
V_MAINTAINER,
V_STATUS,
// these affect voice quality, are independent of language
V_FORMANT,
V_PITCH,
V_ECHO,
V_FLUTTER,
V_ROUGHNESS,
V_CLARITY,
V_TONE,
V_VOICING,
V_BREATH,
V_BREATHW,
// these override defaults set by the translator
V_LOWERCASE_SENTENCE,
V_WORDGAP,
V_INTONATION,
V_TUNES,
V_STRESSLENGTH,
V_STRESSAMP,
V_STRESSADD,
V_DICTRULES,
V_STRESSRULE,
V_STRESSOPT,
V_NUMBERS,
V_MBROLA,
V_KLATT,
V_FAST,
V_SPEED,
V_DICTMIN,
// these need a phoneme table to have been specified
V_REPLACE,
V_CONSONANTS
};
const MNEM_TAB langopts_tab[] = {
{ "dictrules", V_DICTRULES },
{ "intonation", V_INTONATION },
{ "l_dieresis", 0x100+LOPT_DIERESES },
{ "l_prefix", 0x100+LOPT_PREFIXES },
{ "l_regressive_v", 0x100+LOPT_REGRESSIVE_VOICING },
{ "l_unpronouncable", 0x100+LOPT_UNPRONOUNCABLE },
{ "l_sonorant_min", 0x100+LOPT_SONORANT_MIN },
{ "lowercaseSentence", V_LOWERCASE_SENTENCE },
{ "numbers", V_NUMBERS },
{ "stressAdd", V_STRESSADD },
{ "stressAmp", V_STRESSAMP },
{ "stressLength", V_STRESSLENGTH },
{ "stressOpt", V_STRESSOPT },
{ "stressRule", V_STRESSRULE },
{ "tunes", V_TUNES },
{ "words", V_WORDGAP },
{ "maintainer", V_MAINTAINER },
{ "status", V_STATUS },
{ NULL, 0 }
};
static const MNEM_TAB keyword_tab[] = {
{ "name", V_NAME },
{ "language", V_LANGUAGE },
{ "gender", V_GENDER },
{ "variants", V_VARIANTS },
{ "formant", V_FORMANT },
{ "pitch", V_PITCH },
{ "phonemes", V_PHONEMES },
{ "dictionary", V_DICTIONARY },
{ "replace", V_REPLACE },
{ "echo", V_ECHO },
{ "flutter", V_FLUTTER },
{ "roughness", V_ROUGHNESS },
{ "clarity", V_CLARITY },
{ "tone", V_TONE },
{ "voicing", V_VOICING },
{ "breath", V_BREATH },
{ "breathw", V_BREATHW },
{ "mbrola", V_MBROLA },
{ "consonants", V_CONSONANTS },
{ "klatt", V_KLATT },
{ "fast_test2", V_FAST },
{ "speed", V_SPEED },
{ "dict_min", V_DICTMIN },
{ "apostrophe", 0x100+LOPT_APOSTROPHE },
{ "brackets", 0x100+LOPT_BRACKET_PAUSE },
{ "bracketsAnnounced", 0x100+LOPT_BRACKET_PAUSE_ANNOUNCED },
{ NULL, 0 }
};
#define N_VOICE_VARIANTS 12
const char variants_either[N_VOICE_VARIANTS] = { 1, 2, 12, 3, 13, 4, 14, 5, 11, 0 };
const char variants_male[N_VOICE_VARIANTS] = { 1, 2, 3, 4, 5, 6, 0 };