mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-30 14:22:29 +00:00
fixup error message for Bad Voice attribute.
We currently have two switch statements. Every key should go to only one of them.
This commit is contained in:
@@ -81,15 +81,7 @@ enum {
|
|||||||
V_CONSONANTS
|
V_CONSONANTS
|
||||||
};
|
};
|
||||||
|
|
||||||
static const MNEM_TAB langopts_tab[] = {
|
extern const MNEM_TAB langopts_tab[];
|
||||||
{ "lowercaseSentence", V_LOWERCASE_SENTENCE },
|
|
||||||
{ "stressLength", V_STRESSLENGTH },
|
|
||||||
|
|
||||||
{ "maintainer", V_MAINTAINER },
|
|
||||||
{ "status", V_STATUS },
|
|
||||||
|
|
||||||
{ NULL, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
void LoadLanguageOptions(Translator *translator, int key, char *keyValue ) {
|
void LoadLanguageOptions(Translator *translator, int key, char *keyValue ) {
|
||||||
int ix;
|
int ix;
|
||||||
|
|||||||
+272
-263
@@ -120,16 +120,21 @@ enum {
|
|||||||
V_CONSONANTS
|
V_CONSONANTS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const MNEM_TAB langopts_tab[] = {
|
||||||
|
{ "lowercaseSentence", V_LOWERCASE_SENTENCE },
|
||||||
|
{ "stressLength", V_STRESSLENGTH },
|
||||||
|
|
||||||
|
{ "maintainer", V_MAINTAINER },
|
||||||
|
{ "status", V_STATUS },
|
||||||
|
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static const MNEM_TAB keyword_tab[] = {
|
static const MNEM_TAB keyword_tab[] = {
|
||||||
{ "name", V_NAME },
|
{ "name", V_NAME },
|
||||||
{ "language", V_LANGUAGE },
|
{ "language", V_LANGUAGE },
|
||||||
{ "gender", V_GENDER },
|
{ "gender", V_GENDER },
|
||||||
|
|
||||||
{ "maintainer", V_MAINTAINER },
|
|
||||||
{ "status", V_STATUS },
|
|
||||||
|
|
||||||
|
|
||||||
{ "lowercaseSentence", V_LOWERCASE_SENTENCE },
|
|
||||||
{ "variants", V_VARIANTS },
|
{ "variants", V_VARIANTS },
|
||||||
{ "formant", V_FORMANT },
|
{ "formant", V_FORMANT },
|
||||||
{ "pitch", V_PITCH },
|
{ "pitch", V_PITCH },
|
||||||
@@ -137,7 +142,6 @@ static const MNEM_TAB keyword_tab[] = {
|
|||||||
{ "dictionary", V_DICTIONARY },
|
{ "dictionary", V_DICTIONARY },
|
||||||
{ "stressAmp", V_STRESSAMP },
|
{ "stressAmp", V_STRESSAMP },
|
||||||
{ "stressAdd", V_STRESSADD },
|
{ "stressAdd", V_STRESSADD },
|
||||||
{ "stressLength", V_STRESSLENGTH },
|
|
||||||
{ "intonation", V_INTONATION },
|
{ "intonation", V_INTONATION },
|
||||||
{ "tunes", V_TUNES },
|
{ "tunes", V_TUNES },
|
||||||
{ "dictrules", V_DICTRULES },
|
{ "dictrules", V_DICTRULES },
|
||||||
@@ -631,293 +635,298 @@ voice_t *LoadVoice(const char *vname, int control)
|
|||||||
|
|
||||||
if (buf[0] == 0) continue;
|
if (buf[0] == 0) continue;
|
||||||
|
|
||||||
key = LookupMnem(keyword_tab, buf);
|
key = LookupMnem(langopts_tab, buf);
|
||||||
|
|
||||||
LoadLanguageOptions(translator, key, p);
|
if (key != 0) {
|
||||||
|
LoadLanguageOptions(translator, key, p);
|
||||||
|
} else {
|
||||||
|
key = LookupMnem(keyword_tab, buf);
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case V_LANGUAGE:
|
||||||
|
{
|
||||||
|
unsigned int len;
|
||||||
|
int priority;
|
||||||
|
|
||||||
switch (key)
|
if (tone_only)
|
||||||
{
|
break;
|
||||||
case V_LANGUAGE:
|
|
||||||
{
|
|
||||||
unsigned int len;
|
|
||||||
int priority;
|
|
||||||
|
|
||||||
if (tone_only)
|
priority = DEFAULT_LANGUAGE_PRIORITY;
|
||||||
break;
|
language_name[0] = 0;
|
||||||
|
|
||||||
priority = DEFAULT_LANGUAGE_PRIORITY;
|
sscanf(p, "%s %d", language_name, &priority);
|
||||||
language_name[0] = 0;
|
if (strcmp(language_name, "variant") == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
sscanf(p, "%s %d", language_name, &priority);
|
len = strlen(language_name) + 2;
|
||||||
if (strcmp(language_name, "variant") == 0)
|
// check for space in languages[]
|
||||||
break;
|
if (len < (sizeof(voice_languages)-langix-1)) {
|
||||||
|
voice_languages[langix] = priority;
|
||||||
|
|
||||||
len = strlen(language_name) + 2;
|
strcpy(&voice_languages[langix+1], language_name);
|
||||||
// check for space in languages[]
|
langix += len;
|
||||||
if (len < (sizeof(voice_languages)-langix-1)) {
|
}
|
||||||
voice_languages[langix] = priority;
|
|
||||||
|
|
||||||
strcpy(&voice_languages[langix+1], language_name);
|
// only act on the first language line
|
||||||
langix += len;
|
if (language_set == false) {
|
||||||
}
|
language_type = strtok(language_name, "-");
|
||||||
|
language_set = true;
|
||||||
|
strcpy(translator_name, language_type);
|
||||||
|
strcpy(new_dictionary, language_type);
|
||||||
|
strcpy(phonemes_name, language_type);
|
||||||
|
SelectPhonemeTableName(phonemes_name);
|
||||||
|
|
||||||
// only act on the first language line
|
translator = SelectTranslator(translator_name);
|
||||||
if (language_set == false) {
|
strncpy0(voice->language_name, language_name, sizeof(voice->language_name));
|
||||||
language_type = strtok(language_name, "-");
|
}
|
||||||
language_set = true;
|
}
|
||||||
strcpy(translator_name, language_type);
|
break;
|
||||||
strcpy(new_dictionary, language_type);
|
case V_NAME:
|
||||||
strcpy(phonemes_name, language_type);
|
if (tone_only == 0) {
|
||||||
SelectPhonemeTableName(phonemes_name);
|
while (isspace(*p)) p++;
|
||||||
|
strncpy0(voice_name, p, sizeof(voice_name));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case V_GENDER:
|
||||||
|
{
|
||||||
|
int age = 0;
|
||||||
|
char vgender[80];
|
||||||
|
sscanf(p, "%s %d", vgender, &age);
|
||||||
|
current_voice_selected.gender = LookupMnem(genders, vgender);
|
||||||
|
current_voice_selected.age = age;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case V_DICTIONARY: // dictionary
|
||||||
|
sscanf(p, "%s", new_dictionary);
|
||||||
|
break;
|
||||||
|
case V_PHONEMES: // phoneme table
|
||||||
|
sscanf(p, "%s", phonemes_name);
|
||||||
|
break;
|
||||||
|
case V_FORMANT:
|
||||||
|
VoiceFormant(p);
|
||||||
|
break;
|
||||||
|
case V_PITCH:
|
||||||
|
// default is pitch 82 118
|
||||||
|
if (sscanf(p, "%d %d", &pitch1, &pitch2) == 2) {
|
||||||
|
voice->pitch_base = (pitch1 - 9) << 12;
|
||||||
|
voice->pitch_range = (pitch2 - pitch1) * 108;
|
||||||
|
double factor = (double)(pitch1 - 82)/82;
|
||||||
|
voice->formant_factor = (int)((1+factor/4) * 256); // nominal formant shift for a different voice pitch
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
translator = SelectTranslator(translator_name);
|
|
||||||
strncpy0(voice->language_name, language_name, sizeof(voice->language_name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case V_NAME:
|
|
||||||
if (tone_only == 0) {
|
|
||||||
while (isspace(*p)) p++;
|
|
||||||
strncpy0(voice_name, p, sizeof(voice_name));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case V_GENDER:
|
|
||||||
{
|
|
||||||
int age = 0;
|
|
||||||
char vgender[80];
|
|
||||||
sscanf(p, "%s %d", vgender, &age);
|
|
||||||
current_voice_selected.gender = LookupMnem(genders, vgender);
|
|
||||||
current_voice_selected.age = age;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case V_DICTIONARY: // dictionary
|
|
||||||
sscanf(p, "%s", new_dictionary);
|
|
||||||
break;
|
|
||||||
case V_PHONEMES: // phoneme table
|
|
||||||
sscanf(p, "%s", phonemes_name);
|
|
||||||
break;
|
|
||||||
case V_FORMANT:
|
|
||||||
VoiceFormant(p);
|
|
||||||
break;
|
|
||||||
case V_PITCH:
|
|
||||||
// default is pitch 82 118
|
|
||||||
if (sscanf(p, "%d %d", &pitch1, &pitch2) == 2) {
|
|
||||||
voice->pitch_base = (pitch1 - 9) << 12;
|
|
||||||
voice->pitch_range = (pitch2 - pitch1) * 108;
|
|
||||||
double factor = (double)(pitch1 - 82)/82;
|
|
||||||
voice->formant_factor = (int)((1+factor/4) * 256); // nominal formant shift for a different voice pitch
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case V_STRESSAMP: { // stressAmp
|
case V_STRESSAMP: { // stressAmp
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int stress_amps_set = 0;
|
int stress_amps_set = 0;
|
||||||
int stress_amps[8];
|
int stress_amps[8];
|
||||||
stress_amps_set = Read8Numbers(p, stress_amps);
|
stress_amps_set = Read8Numbers(p, stress_amps);
|
||||||
for (ix = 0; ix < stress_amps_set; ix++) {
|
for (ix = 0; ix < stress_amps_set; ix++) {
|
||||||
translator->stress_amps[ix] = stress_amps[ix];
|
translator->stress_amps[ix] = stress_amps[ix];
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case V_STRESSADD: { // stressAdd
|
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
int stress_add_set = 0;
|
case V_STRESSADD: { // stressAdd
|
||||||
stress_add_set = Read8Numbers(p, stress_add);
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
for (ix = 0; ix < stress_add_set; ix++) {
|
int stress_add_set = 0;
|
||||||
translator->stress_lengths[ix] += stress_add[ix];
|
stress_add_set = Read8Numbers(p, stress_add);
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
for (ix = 0; ix < stress_add_set; ix++) {
|
||||||
}
|
translator->stress_lengths[ix] += stress_add[ix];
|
||||||
case V_INTONATION: // intonation
|
}
|
||||||
sscanf(p, "%d", &option_tone_flags);
|
|
||||||
if ((option_tone_flags & 0xff) != 0) {
|
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
translator->langopts.intonation_group = option_tone_flags & 0xff;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case V_INTONATION: // intonation
|
||||||
case V_TUNES:
|
sscanf(p, "%d", &option_tone_flags);
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
if ((option_tone_flags & 0xff) != 0) {
|
||||||
break;
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
n = sscanf(p, "%s %s %s %s %s %s", names[0], names[1], names[2], names[3], names[4], names[5]);
|
translator->langopts.intonation_group = option_tone_flags & 0xff;
|
||||||
translator->langopts.intonation_group = 0;
|
}
|
||||||
|
break;
|
||||||
|
case V_TUNES:
|
||||||
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
for (ix = 0; ix < n; ix++) {
|
n = sscanf(p, "%s %s %s %s %s %s", names[0], names[1], names[2], names[3], names[4], names[5]);
|
||||||
if (strcmp(names[ix], "NULL") == 0)
|
translator->langopts.intonation_group = 0;
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((value = LookupTune(names[ix])) < 0)
|
for (ix = 0; ix < n; ix++) {
|
||||||
fprintf(stderr, "Unknown tune '%s'\n", names[ix]);
|
if (strcmp(names[ix], "NULL") == 0)
|
||||||
else
|
continue;
|
||||||
translator->langopts.tunes[ix] = value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case V_DICTRULES: // conditional dictionary rules and list entries
|
if ((value = LookupTune(names[ix])) < 0)
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
fprintf(stderr, "Unknown tune '%s'\n", names[ix]);
|
||||||
break;
|
else
|
||||||
|
translator->langopts.tunes[ix] = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
ReadNumbers(p, &translator->dict_condition, 32, keyword_tab, key);
|
case V_DICTRULES: // conditional dictionary rules and list entries
|
||||||
break;
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
case V_STRESSOPT:
|
break;
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
ReadNumbers(p, &translator->langopts.stress_flags, 32, keyword_tab, key);
|
ReadNumbers(p, &translator->dict_condition, 32, keyword_tab, key);
|
||||||
break;
|
break;
|
||||||
|
case V_STRESSOPT:
|
||||||
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
case V_NUMBERS:
|
ReadNumbers(p, &translator->langopts.stress_flags, 32, keyword_tab, key);
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
// expect a list of numbers
|
case V_NUMBERS:
|
||||||
while (*p != 0) {
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
while (isspace(*p)) p++;
|
break;
|
||||||
if ((n = atoi(p)) > 0) {
|
|
||||||
p++;
|
|
||||||
if (n < 32) {
|
|
||||||
translator->langopts.numbers |= (1 << n);
|
|
||||||
} else {
|
|
||||||
if (n < 64)
|
|
||||||
translator->langopts.numbers2 |= (1 << (n-32));
|
|
||||||
else
|
|
||||||
fprintf(stderr, "numbers: Bad option number %d\n", n); }
|
|
||||||
}
|
|
||||||
while (isalnum(*p)) p++;
|
|
||||||
}
|
|
||||||
ProcessLanguageOptions(&(translator->langopts));
|
|
||||||
|
|
||||||
break;
|
// expect a list of numbers
|
||||||
case V_REPLACE:
|
while (*p != 0) {
|
||||||
if (phonemes_set == false) {
|
while (isspace(*p)) p++;
|
||||||
// must set up a phoneme table before we can lookup phoneme mnemonics
|
if ((n = atoi(p)) > 0) {
|
||||||
SelectPhonemeTableName(phonemes_name);
|
p++;
|
||||||
phonemes_set = true;
|
if (n < 32) {
|
||||||
}
|
translator->langopts.numbers |= (1 << n);
|
||||||
PhonemeReplacement(p);
|
} else {
|
||||||
break;
|
if (n < 64)
|
||||||
case V_WORDGAP: // words
|
translator->langopts.numbers2 |= (1 << (n-32));
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
else
|
||||||
break;
|
fprintf(stderr, "numbers: Bad option number %d\n", n); }
|
||||||
|
}
|
||||||
|
while (isalnum(*p)) p++;
|
||||||
|
}
|
||||||
|
ProcessLanguageOptions(&(translator->langopts));
|
||||||
|
|
||||||
sscanf(p, "%d %d", &translator->langopts.word_gap, &translator->langopts.vowel_pause);
|
break;
|
||||||
break;
|
case V_REPLACE:
|
||||||
case V_STRESSRULE:
|
if (phonemes_set == false) {
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
// must set up a phoneme table before we can lookup phoneme mnemonics
|
||||||
break;
|
SelectPhonemeTableName(phonemes_name);
|
||||||
|
phonemes_set = true;
|
||||||
|
}
|
||||||
|
PhonemeReplacement(p);
|
||||||
|
break;
|
||||||
|
case V_WORDGAP: // words
|
||||||
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
sscanf(p, "%d %d %d", &translator->langopts.stress_rule,
|
sscanf(p, "%d %d", &translator->langopts.word_gap, &translator->langopts.vowel_pause);
|
||||||
&translator->langopts.unstressed_wd1,
|
break;
|
||||||
&translator->langopts.unstressed_wd2);
|
case V_STRESSRULE:
|
||||||
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
break;
|
sscanf(p, "%d %d %d", &translator->langopts.stress_rule,
|
||||||
case V_ECHO:
|
&translator->langopts.unstressed_wd1,
|
||||||
// echo. suggest: 135mS 11%
|
&translator->langopts.unstressed_wd2);
|
||||||
value = 0;
|
|
||||||
voice->echo_amp = 0;
|
|
||||||
sscanf(p, "%d %d", &voice->echo_delay, &voice->echo_amp);
|
|
||||||
break;
|
|
||||||
case V_FLUTTER: // flutter
|
|
||||||
if (sscanf(p, "%d", &value) == 1)
|
|
||||||
voice->flutter = value * 32;
|
|
||||||
break;
|
|
||||||
case V_ROUGHNESS: // roughness
|
|
||||||
if (sscanf(p, "%d", &value) == 1)
|
|
||||||
voice->roughness = value;
|
|
||||||
break;
|
|
||||||
case V_CLARITY: // formantshape
|
|
||||||
if (sscanf(p, "%d", &value) == 1) {
|
|
||||||
if (value > 4) {
|
|
||||||
voice->peak_shape = 1; // squarer formant peaks
|
|
||||||
value = 4;
|
|
||||||
}
|
|
||||||
voice->n_harmonic_peaks = 1+value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case V_TONE:
|
|
||||||
{
|
|
||||||
int tone_data[12];
|
|
||||||
ReadTonePoints(p, tone_data);
|
|
||||||
SetToneAdjust(voice, tone_data);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case V_VOICING:
|
|
||||||
if (sscanf(p, "%d", &value) == 1)
|
|
||||||
voice->voicing = (value * 64)/100;
|
|
||||||
break;
|
|
||||||
case V_BREATH:
|
|
||||||
voice->breath[0] = Read8Numbers(p, &voice->breath[1]);
|
|
||||||
for (ix = 1; ix < 8; ix++) {
|
|
||||||
if (ix % 2)
|
|
||||||
voice->breath[ix] = -voice->breath[ix];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case V_BREATHW:
|
|
||||||
voice->breathw[0] = Read8Numbers(p, &voice->breathw[1]);
|
|
||||||
break;
|
|
||||||
case V_CONSONANTS:
|
|
||||||
value = sscanf(p, "%d %d", &voice->consonant_amp, &voice->consonant_ampv);
|
|
||||||
break;
|
|
||||||
case V_SPEED:
|
|
||||||
sscanf(p, "%d", &voice->speed_percent);
|
|
||||||
SetSpeed(3);
|
|
||||||
break;
|
|
||||||
case V_MBROLA:
|
|
||||||
{
|
|
||||||
int srate = 16000;
|
|
||||||
|
|
||||||
name2[0] = 0;
|
break;
|
||||||
sscanf(p, "%s %s %d", name1, name2, &srate);
|
case V_ECHO:
|
||||||
espeak_ng_STATUS status = LoadMbrolaTable(name1, name2, &srate);
|
// echo. suggest: 135mS 11%
|
||||||
if (status != ENS_OK) {
|
value = 0;
|
||||||
espeak_ng_PrintStatusCodeMessage(status, stderr, NULL);
|
voice->echo_amp = 0;
|
||||||
fclose(f_voice);
|
sscanf(p, "%d %d", &voice->echo_delay, &voice->echo_amp);
|
||||||
return NULL;
|
break;
|
||||||
}
|
case V_FLUTTER: // flutter
|
||||||
else
|
if (sscanf(p, "%d", &value) == 1)
|
||||||
voice->samplerate = srate;
|
voice->flutter = value * 32;
|
||||||
}
|
break;
|
||||||
break;
|
case V_ROUGHNESS: // roughness
|
||||||
case V_KLATT:
|
if (sscanf(p, "%d", &value) == 1)
|
||||||
voice->klattv[0] = 1; // default source: IMPULSIVE
|
voice->roughness = value;
|
||||||
Read8Numbers(p, voice->klattv);
|
break;
|
||||||
voice->klattv[KLATT_Kopen] -= 40;
|
case V_CLARITY: // formantshape
|
||||||
break;
|
if (sscanf(p, "%d", &value) == 1) {
|
||||||
case V_FAST:
|
if (value > 4) {
|
||||||
sscanf(p, "%d", &speed.fast_settings);
|
voice->peak_shape = 1; // squarer formant peaks
|
||||||
SetSpeed(3);
|
value = 4;
|
||||||
break;
|
}
|
||||||
case V_DICTMIN: {
|
voice->n_harmonic_peaks = 1+value;
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
}
|
||||||
break;
|
break;
|
||||||
|
case V_TONE:
|
||||||
|
{
|
||||||
|
int tone_data[12];
|
||||||
|
ReadTonePoints(p, tone_data);
|
||||||
|
SetToneAdjust(voice, tone_data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case V_VOICING:
|
||||||
|
if (sscanf(p, "%d", &value) == 1)
|
||||||
|
voice->voicing = (value * 64)/100;
|
||||||
|
break;
|
||||||
|
case V_BREATH:
|
||||||
|
voice->breath[0] = Read8Numbers(p, &voice->breath[1]);
|
||||||
|
for (ix = 1; ix < 8; ix++) {
|
||||||
|
if (ix % 2)
|
||||||
|
voice->breath[ix] = -voice->breath[ix];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case V_BREATHW:
|
||||||
|
voice->breathw[0] = Read8Numbers(p, &voice->breathw[1]);
|
||||||
|
break;
|
||||||
|
case V_CONSONANTS:
|
||||||
|
value = sscanf(p, "%d %d", &voice->consonant_amp, &voice->consonant_ampv);
|
||||||
|
break;
|
||||||
|
case V_SPEED:
|
||||||
|
sscanf(p, "%d", &voice->speed_percent);
|
||||||
|
SetSpeed(3);
|
||||||
|
break;
|
||||||
|
case V_MBROLA:
|
||||||
|
{
|
||||||
|
int srate = 16000;
|
||||||
|
|
||||||
if (sscanf(p, "%d", &value) == 1)
|
name2[0] = 0;
|
||||||
translator->dict_min_size = value;
|
sscanf(p, "%s %s %d", name1, name2, &srate);
|
||||||
break;
|
espeak_ng_STATUS status = LoadMbrolaTable(name1, name2, &srate);
|
||||||
}
|
if (status != ENS_OK) {
|
||||||
|
espeak_ng_PrintStatusCodeMessage(status, stderr, NULL);
|
||||||
|
fclose(f_voice);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
voice->samplerate = srate;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case V_KLATT:
|
||||||
|
voice->klattv[0] = 1; // default source: IMPULSIVE
|
||||||
|
Read8Numbers(p, voice->klattv);
|
||||||
|
voice->klattv[KLATT_Kopen] -= 40;
|
||||||
|
break;
|
||||||
|
case V_FAST:
|
||||||
|
sscanf(p, "%d", &speed.fast_settings);
|
||||||
|
SetSpeed(3);
|
||||||
|
break;
|
||||||
|
case V_DICTMIN: {
|
||||||
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
break;
|
if (sscanf(p, "%d", &value) == 1)
|
||||||
case V_MAINTAINER:
|
translator->dict_min_size = value;
|
||||||
case V_STATUS:
|
break;
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
if ((key & 0xff00) == 0x100) {
|
break;
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
case V_MAINTAINER:
|
||||||
break;
|
case V_STATUS:
|
||||||
sscanf(p, "%d", &translator->langopts.param[key &0xff]);
|
break;
|
||||||
} else
|
default:
|
||||||
fprintf(stderr, "Bad voice attribute: %s\n", buf);
|
if ((key & 0xff00) == 0x100) {
|
||||||
break;
|
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
||||||
}
|
break;
|
||||||
|
sscanf(p, "%d", &translator->langopts.param[key &0xff]);
|
||||||
|
} else
|
||||||
|
fprintf(stderr, "Bad voice attribute: %s\n", buf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (f_voice != NULL)
|
if (f_voice != NULL)
|
||||||
fclose(f_voice);
|
fclose(f_voice);
|
||||||
|
|||||||
Reference in New Issue
Block a user