mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
code cleanup: do not compile mbrola if not enabled
This commit is contained in:
@@ -89,8 +89,10 @@ static const char *help_text =
|
||||
"\t Compile pronunciation rules and dictionary from the current\n"
|
||||
"\t directory, including line numbers for use with -X.\n"
|
||||
"\t <voice name> specifies the language\n"
|
||||
#if USE_MBROLA
|
||||
"--compile-mbrola=<voice name>\n"
|
||||
"\t Compile an MBROLA voice\n"
|
||||
#endif
|
||||
"--compile-intonations\n"
|
||||
"\t Compile the intonation data\n"
|
||||
"--compile-phonemes=<phsource-dir>\n"
|
||||
@@ -323,7 +325,9 @@ int main(int argc, char **argv)
|
||||
{ "version", no_argument, 0, 0x10b },
|
||||
{ "sep", optional_argument, 0, 0x10c },
|
||||
{ "tie", optional_argument, 0, 0x10d },
|
||||
#if USE_MBROLA
|
||||
{ "compile-mbrola", optional_argument, 0, 0x10e },
|
||||
#endif
|
||||
{ "compile-intonations", no_argument, 0, 0x10f },
|
||||
{ "compile-phonemes", optional_argument, 0, 0x110 },
|
||||
{ "load", no_argument, 0, 0x111 },
|
||||
@@ -536,6 +540,7 @@ int main(int argc, char **argv)
|
||||
if (phonemes_separator == 'z')
|
||||
phonemes_separator = 0x200d; // ZWJ
|
||||
break;
|
||||
#if USE_MBROLA
|
||||
case 0x10e: // --compile-mbrola
|
||||
{
|
||||
espeak_ng_InitializePath(data_path);
|
||||
@@ -548,6 +553,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
case 0x10f: // --compile-intonations
|
||||
{
|
||||
espeak_ng_InitializePath(data_path);
|
||||
|
||||
@@ -523,6 +523,10 @@ void MarkerEvent(int type, unsigned int char_position, int value, int value2, un
|
||||
ep->text_position = char_position & 0xffffff;
|
||||
ep->length = char_position >> 24;
|
||||
|
||||
#if !USE_MBROLA
|
||||
static const int mbrola_delay = 0;
|
||||
#endif
|
||||
|
||||
time = ((double)(count_samples + mbrola_delay + (out_ptr - out_start)/2)*1000.0)/samplerate;
|
||||
ep->audio_position = (int)time;
|
||||
ep->sample = (count_samples + mbrola_delay + (out_ptr - out_start)/2);
|
||||
|
||||
@@ -639,10 +639,14 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
{
|
||||
case 1: // PreVoicing
|
||||
return control & 1;
|
||||
#if USE_KLATT
|
||||
case 2: // KlattSynth
|
||||
return voice->klattv[0] != 0;
|
||||
#endif
|
||||
#if USE_MBROLA
|
||||
case 3: // MbrolaSynth
|
||||
return mbrola_name[0] != 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1148,8 +1148,10 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume)
|
||||
if (option_phoneme_events & espeakINITIALIZE_PHONEME_IPA)
|
||||
use_ipa = 1;
|
||||
|
||||
#if USE_MBROLA
|
||||
if (mbrola_name[0] != 0)
|
||||
return MbrolaGenerate(phoneme_list, n_ph, resume);
|
||||
#endif
|
||||
|
||||
if (resume == false) {
|
||||
ix = 1;
|
||||
|
||||
@@ -305,7 +305,9 @@ void VoiceReset(int tone_only)
|
||||
|
||||
if (tone_only == 0) {
|
||||
n_replace_phonemes = 0;
|
||||
#if USE_MBROLA
|
||||
LoadMbrolaTable(NULL, NULL, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// probably unnecessary, but removing this would break tests
|
||||
@@ -649,6 +651,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
sscanf(p, "%d", &voice->speed_percent);
|
||||
SetSpeed(3);
|
||||
break;
|
||||
#if USE_MBROLA
|
||||
case V_MBROLA:
|
||||
{
|
||||
int srate = 16000;
|
||||
@@ -665,11 +668,14 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
voice->samplerate = srate;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if USE_KLATT
|
||||
case V_KLATT:
|
||||
voice->klattv[0] = 1; // default source: IMPULSIVE
|
||||
Read8Numbers(p, voice->klattv);
|
||||
voice->klattv[KLATT_Kopen] -= 40;
|
||||
break;
|
||||
#endif
|
||||
case V_FAST:
|
||||
sscanf(p, "%d", &speed.fast_settings);
|
||||
SetSpeed(3);
|
||||
|
||||
@@ -246,8 +246,10 @@ void WcmdqStop()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_MBROLA
|
||||
if (mbrola_name[0] != 0)
|
||||
MbrolaReset();
|
||||
#endif
|
||||
}
|
||||
|
||||
int WcmdqFree()
|
||||
|
||||
Reference in New Issue
Block a user