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



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


uninstall-hook: uninstall-hook:
rm -rf $(DESTDIR)$(DATADIR) rm -rf $(DESTDIR)$(DATADIR)
src/libespeak-ng/common.c \ src/libespeak-ng/common.c \
src/libespeak-ng/compiledata.c \ src/libespeak-ng/compiledata.c \
src/libespeak-ng/compiledict.c \ src/libespeak-ng/compiledict.c \
src/libespeak-ng/compilembrola.c \
src/libespeak-ng/dictionary.c \ src/libespeak-ng/dictionary.c \
src/libespeak-ng/encoding.c \ src/libespeak-ng/encoding.c \
src/libespeak-ng/error.c \ src/libespeak-ng/error.c \
src/libespeak-ng/ssml.c \ src/libespeak-ng/ssml.c \
src/libespeak-ng/synthdata.c \ src/libespeak-ng/synthdata.c \
src/libespeak-ng/synthesize.c \ src/libespeak-ng/synthesize.c \
src/libespeak-ng/synth_mbrola.c \
src/libespeak-ng/translate.c \ src/libespeak-ng/translate.c \
src/libespeak-ng/translateword.c \ src/libespeak-ng/translateword.c \
src/libespeak-ng/tr_languages.c \ src/libespeak-ng/tr_languages.c \


if OPT_MBROLA if OPT_MBROLA
AM_CFLAGS += -DUSE_MBROLA=1 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 endif


if OPT_ASYNC if OPT_ASYNC


##### mbrola: ##### mbrola:


if OPT_MBROLA

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


ESPEAK_DATA_PATH=$(CURDIR) src/espeak-ng --compile-mbrola=phsource/mbrola/$* ESPEAK_DATA_PATH=$(CURDIR) src/espeak-ng --compile-mbrola=phsource/mbrola/$*


EXTRA_DIST += $(PHSOURCE_MBROLA) EXTRA_DIST += $(PHSOURCE_MBROLA)

all-local: mbrola

endif

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

"\t Compile pronunciation rules and dictionary from the current\n" "\t Compile pronunciation rules and dictionary from the current\n"
"\t directory, including line numbers for use with -X.\n" "\t directory, including line numbers for use with -X.\n"
"\t <voice name> specifies the language\n" "\t <voice name> specifies the language\n"
#if USE_MBROLA
"--compile-mbrola=<voice name>\n" "--compile-mbrola=<voice name>\n"
"\t Compile an MBROLA voice\n" "\t Compile an MBROLA voice\n"
#endif
"--compile-intonations\n" "--compile-intonations\n"
"\t Compile the intonation data\n" "\t Compile the intonation data\n"
"--compile-phonemes=<phsource-dir>\n" "--compile-phonemes=<phsource-dir>\n"
{ "version", no_argument, 0, 0x10b }, { "version", no_argument, 0, 0x10b },
{ "sep", optional_argument, 0, 0x10c }, { "sep", optional_argument, 0, 0x10c },
{ "tie", optional_argument, 0, 0x10d }, { "tie", optional_argument, 0, 0x10d },
#if USE_MBROLA
{ "compile-mbrola", optional_argument, 0, 0x10e }, { "compile-mbrola", optional_argument, 0, 0x10e },
#endif
{ "compile-intonations", no_argument, 0, 0x10f }, { "compile-intonations", no_argument, 0, 0x10f },
{ "compile-phonemes", optional_argument, 0, 0x110 }, { "compile-phonemes", optional_argument, 0, 0x110 },
{ "load", no_argument, 0, 0x111 }, { "load", no_argument, 0, 0x111 },
if (phonemes_separator == 'z') if (phonemes_separator == 'z')
phonemes_separator = 0x200d; // ZWJ phonemes_separator = 0x200d; // ZWJ
break; break;
#if USE_MBROLA
case 0x10e: // --compile-mbrola case 0x10e: // --compile-mbrola
{ {
espeak_ng_InitializePath(data_path); espeak_ng_InitializePath(data_path);
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#endif
case 0x10f: // --compile-intonations case 0x10f: // --compile-intonations
{ {
espeak_ng_InitializePath(data_path); espeak_ng_InitializePath(data_path);

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

ep->text_position = char_position & 0xffffff; ep->text_position = char_position & 0xffffff;
ep->length = char_position >> 24; 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; time = ((double)(count_samples + mbrola_delay + (out_ptr - out_start)/2)*1000.0)/samplerate;
ep->audio_position = (int)time; ep->audio_position = (int)time;
ep->sample = (count_samples + mbrola_delay + (out_ptr - out_start)/2); ep->sample = (count_samples + mbrola_delay + (out_ptr - out_start)/2);

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

{ {
case 1: // PreVoicing case 1: // PreVoicing
return control & 1; return control & 1;
#if USE_KLATT
case 2: // KlattSynth case 2: // KlattSynth
return voice->klattv[0] != 0; return voice->klattv[0] != 0;
#endif
#if USE_MBROLA
case 3: // MbrolaSynth case 3: // MbrolaSynth
return mbrola_name[0] != 0; return mbrola_name[0] != 0;
#endif
} }
} }
return false; return false;

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

if (option_phoneme_events & espeakINITIALIZE_PHONEME_IPA) if (option_phoneme_events & espeakINITIALIZE_PHONEME_IPA)
use_ipa = 1; use_ipa = 1;


#if USE_MBROLA
if (mbrola_name[0] != 0) if (mbrola_name[0] != 0)
return MbrolaGenerate(phoneme_list, n_ph, resume); return MbrolaGenerate(phoneme_list, n_ph, resume);
#endif


if (resume == false) { if (resume == false) {
ix = 1; ix = 1;

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



if (tone_only == 0) { if (tone_only == 0) {
n_replace_phonemes = 0; n_replace_phonemes = 0;
#if USE_MBROLA
LoadMbrolaTable(NULL, NULL, 0); LoadMbrolaTable(NULL, NULL, 0);
#endif
} }


// probably unnecessary, but removing this would break tests // probably unnecessary, but removing this would break tests
sscanf(p, "%d", &voice->speed_percent); sscanf(p, "%d", &voice->speed_percent);
SetSpeed(3); SetSpeed(3);
break; break;
#if USE_MBROLA
case V_MBROLA: case V_MBROLA:
{ {
int srate = 16000; int srate = 16000;
voice->samplerate = srate; voice->samplerate = srate;
} }
break; break;
#endif
#if USE_KLATT
case V_KLATT: case V_KLATT:
voice->klattv[0] = 1; // default source: IMPULSIVE voice->klattv[0] = 1; // default source: IMPULSIVE
Read8Numbers(p, voice->klattv); Read8Numbers(p, voice->klattv);
voice->klattv[KLATT_Kopen] -= 40; voice->klattv[KLATT_Kopen] -= 40;
break; break;
#endif
case V_FAST: case V_FAST:
sscanf(p, "%d", &speed.fast_settings); sscanf(p, "%d", &speed.fast_settings);
SetSpeed(3); SetSpeed(3);

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

} }
#endif #endif


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


int WcmdqFree() int WcmdqFree()

Loading…
Cancel
Save