mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Use ESPEAKNG_DEFAULT_VOICE instead of hard coded "en".
This will make it easier to set a default voice other than
English. This is important for cases when a language will fall back to
the default voice.
Some references to L('e', 'n') still need to be changed.
This commit is contained in:
@@ -378,8 +378,8 @@ const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme)
|
||||
}
|
||||
*outptr = 0;
|
||||
if (c == 0) {
|
||||
if (strcmp(p_lang, "en") == 0) {
|
||||
*p_lang = 0; // don't need "en", it's assumed by default
|
||||
if (strcmp(p_lang, ESPEAKNG_DEFAULT_VOICE) == 0) {
|
||||
*p_lang = 0; // don't need ESPEAKNG_DEFAULT_VOICE, it's assumed by default
|
||||
return p;
|
||||
}
|
||||
} else
|
||||
|
||||
@@ -500,7 +500,7 @@ void LookupLetter(Translator *tr, unsigned int letter, int next_byte, char *ph_b
|
||||
if (tr->translator_name == L('e', 'n'))
|
||||
return; // we are already using English
|
||||
|
||||
SetTranslator2("en");
|
||||
SetTranslator2(ESPEAKNG_DEFAULT_VOICE);
|
||||
if (Lookup(translator2, &single_letter[2], ph_buf3) != 0) {
|
||||
// yes, switch to English and re-translate the word
|
||||
sprintf(ph_buf1, "%c", phonSWITCH);
|
||||
@@ -719,7 +719,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, ALP
|
||||
// don't say "superscript" during normal text reading
|
||||
Lookup(tr, modifier, capital);
|
||||
if (capital[0] == 0) {
|
||||
capital[2] = SetTranslator2("en"); // overwrites previous contents of translator2
|
||||
capital[2] = SetTranslator2(ESPEAKNG_DEFAULT_VOICE); // overwrites previous contents of translator2
|
||||
Lookup(translator2, modifier, &capital[3]);
|
||||
if (capital[3] != 0) {
|
||||
capital[0] = phonPAUSE;
|
||||
@@ -763,7 +763,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, ALP
|
||||
ph_buf2[0] = 0;
|
||||
if (Lookup(translator, alphabet->name, ph_alphabet) == 0) { // the original language for the current voice
|
||||
// Can't find the local name for this alphabet, use the English name
|
||||
ph_alphabet[2] = SetTranslator2("en"); // overwrites previous contents of translator2
|
||||
ph_alphabet[2] = SetTranslator2(ESPEAKNG_DEFAULT_VOICE); // overwrites previous contents of translator2
|
||||
Lookup(translator2, alphabet->name, ph_buf2);
|
||||
} else if (translator != tr) {
|
||||
phontab_1 = tr->phoneme_tab_ix;
|
||||
|
||||
@@ -253,7 +253,7 @@ static const char *LookupCharName(Translator *tr, int c, int only)
|
||||
|
||||
if ((only == 0) && ((phonemes[0] == 0) || (phonemes[0] == phonSWITCH)) && (tr->translator_name != L('e', 'n'))) {
|
||||
// not found, try English
|
||||
SetTranslator2("en");
|
||||
SetTranslator2(ESPEAKNG_DEFAULT_VOICE);
|
||||
string = &single_letter[1];
|
||||
single_letter[1] = '_';
|
||||
if (LookupDictList(translator2, &string, phonemes, flags, 0, NULL) == 0) {
|
||||
@@ -261,7 +261,7 @@ static const char *LookupCharName(Translator *tr, int c, int only)
|
||||
LookupDictList(translator2, &string, phonemes, flags, 0, NULL);
|
||||
}
|
||||
if (phonemes[0])
|
||||
lang_name = "en";
|
||||
lang_name = ESPEAKNG_DEFAULT_VOICE;
|
||||
else
|
||||
SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table
|
||||
}
|
||||
@@ -270,7 +270,7 @@ static const char *LookupCharName(Translator *tr, int c, int only)
|
||||
if (lang_name) {
|
||||
SetWordStress(translator2, phonemes, flags, -1, 0);
|
||||
DecodePhonemes(phonemes, phonemes2);
|
||||
sprintf(buf, "[\002_^_%s %s _^_%s]]", "en", phonemes2, WordToString2(tr->translator_name));
|
||||
sprintf(buf, "[\002_^_%s %s _^_%s]]", ESPEAKNG_DEFAULT_VOICE, phonemes2, WordToString2(tr->translator_name));
|
||||
SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table
|
||||
} else {
|
||||
SetWordStress(tr, phonemes, flags, -1, 0);
|
||||
|
||||
@@ -442,7 +442,7 @@ static espeak_ng_STATUS Synthesize(unsigned int unique_identifier, const void *t
|
||||
|
||||
espeak_ng_STATUS status;
|
||||
if (translator == NULL) {
|
||||
status = espeak_ng_SetVoiceByName("en");
|
||||
status = espeak_ng_SetVoiceByName(ESPEAKNG_DEFAULT_VOICE);
|
||||
if (status != ENS_OK)
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ static int TranslateWord3(Translator *tr, char *word_start, WORD_TAB *wtab, char
|
||||
if (unpron_phonemes[0] == phonSWITCH) {
|
||||
// change to another language in order to translate this word
|
||||
strcpy(word_phonemes, unpron_phonemes);
|
||||
if (strcmp(&unpron_phonemes[1], "en") == 0)
|
||||
if (strcmp(&unpron_phonemes[1], ESPEAKNG_DEFAULT_VOICE) == 0)
|
||||
return FLAG_SPELLWORD; // _^_en must have been set in TranslateLetter(), not *_rules which uses only _^_
|
||||
return 0;
|
||||
}
|
||||
@@ -1423,7 +1423,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
|
||||
new_language = (char *)(&p[1]);
|
||||
if (new_language[0] == 0)
|
||||
new_language = "en";
|
||||
new_language = ESPEAKNG_DEFAULT_VOICE;
|
||||
|
||||
switch_phonemes = SetTranslator2(new_language);
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
f_voice = fopen(buf, "r");
|
||||
|
||||
if (!(control & 8)/*compiling phonemes*/)
|
||||
language_type = "en"; // default
|
||||
language_type = ESPEAKNG_DEFAULT_VOICE; // default
|
||||
else
|
||||
language_type = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user