Browse Source

code cleanup: do not compile mbrola if not enabled

master
Yury Popov 2 years ago
parent
commit
78ac6c4a88
No account linked to committer's email address

+ 11
- 5
Makefile.am View File

@@ -50,8 +50,7 @@ EXTRA_DIST += ChangeLog

all-local: \
espeak-ng-data/phontab \
dictionaries \
mbrola
dictionaries

uninstall-hook:
rm -rf $(DESTDIR)$(DATADIR)
@@ -158,7 +157,6 @@ src_libespeak_ng_la_SOURCES = \
src/libespeak-ng/common.c \
src/libespeak-ng/compiledata.c \
src/libespeak-ng/compiledict.c \
src/libespeak-ng/compilembrola.c \
src/libespeak-ng/dictionary.c \
src/libespeak-ng/encoding.c \
src/libespeak-ng/error.c \
@@ -178,7 +176,6 @@ src_libespeak_ng_la_SOURCES = \
src/libespeak-ng/ssml.c \
src/libespeak-ng/synthdata.c \
src/libespeak-ng/synthesize.c \
src/libespeak-ng/synth_mbrola.c \
src/libespeak-ng/translate.c \
src/libespeak-ng/translateword.c \
src/libespeak-ng/tr_languages.c \
@@ -244,7 +241,10 @@ endif

if OPT_MBROLA
AM_CFLAGS += -DUSE_MBROLA=1
src_libespeak_ng_la_SOURCES += src/libespeak-ng/mbrowrap.c
src_libespeak_ng_la_SOURCES += \
src/libespeak-ng/mbrowrap.c \
src/libespeak-ng/synth_mbrola.c \
src/libespeak-ng/compilembrola.c
endif

if OPT_ASYNC
@@ -956,6 +956,8 @@ dictsource/yue_emoji:

##### mbrola:

if OPT_MBROLA

PHSOURCE_MBROLA = \
$(wildcard phsource/mbrola/*)

@@ -967,3 +969,7 @@ espeak-ng-data/mbrola_ph/%_phtrans: phsource/mbrola/% src/espeak-ng
ESPEAK_DATA_PATH=$(CURDIR) src/espeak-ng --compile-mbrola=phsource/mbrola/$*

EXTRA_DIST += $(PHSOURCE_MBROLA)

all-local: mbrola

endif

+ 6
- 0
src/espeak-ng.c View File

@@ -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);

+ 4
- 0
src/libespeak-ng/speech.c View File

@@ -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);

+ 4
- 0
src/libespeak-ng/synthdata.c View File

@@ -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;

+ 2
- 0
src/libespeak-ng/synthesize.c View File

@@ -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;

+ 6
- 0
src/libespeak-ng/voices.c View File

@@ -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);

+ 2
- 0
src/libespeak-ng/wavegen.c View File

@@ -246,8 +246,10 @@ void WcmdqStop()
}
#endif

#if USE_MBROLA
if (mbrola_name[0] != 0)
MbrolaReset();
#endif
}

int WcmdqFree()

Loading…
Cancel
Save