From 29cba35a9ea4d3df96aef8a37ea876b14db1e903 Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sun, 11 Mar 2018 11:29:04 +0200 Subject: [PATCH] headers: add new file mbrola.h with declarations of functions in compilembrola.c and synth_mbrola.c --- src/libespeak-ng/compilembrola.c | 2 + src/libespeak-ng/mbrola.h | 66 ++++++++++++++++++++++++++++++++ src/libespeak-ng/speech.c | 1 + src/libespeak-ng/speech.h | 2 + src/libespeak-ng/synth_mbrola.c | 7 +++- src/libespeak-ng/synthesize.c | 4 +- src/libespeak-ng/synthesize.h | 17 -------- 7 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 src/libespeak-ng/mbrola.h diff --git a/src/libespeak-ng/compilembrola.c b/src/libespeak-ng/compilembrola.c index 2f96ba47..4c40f84e 100644 --- a/src/libespeak-ng/compilembrola.c +++ b/src/libespeak-ng/compilembrola.c @@ -28,6 +28,8 @@ #include #include +#include "mbrola.h" + #include "error.h" #include "phoneme.h" #include "speech.h" diff --git a/src/libespeak-ng/mbrola.h b/src/libespeak-ng/mbrola.h new file mode 100644 index 00000000..ce898d9e --- /dev/null +++ b/src/libespeak-ng/mbrola.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2005 to 2015 by Jonathan Duddington + * email: jonsd@users.sourceforge.net + * Copyright (C) 2015-2018 Reece H. Dunn + * Copyright (C) 2018 Juho Hiltunen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see: . + */ + +// declarations for compilembrola.c and synth_mbrola.c + +#ifndef ESPEAK_NG_MBROLA_H +#define ESPEAK_NG_MBROLA_H + +#include + +#include "synthesize.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct { + int name; + unsigned int next_phoneme; + int mbr_name; + int mbr_name2; + int percent; // percentage length of first component + int control; +} MBROLA_TAB; + +extern int mbrola_delay; +extern char mbrola_name[20]; + +espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, + const char *phtrans, + int *srate); + +int MbrolaGenerate(PHONEME_LIST *phoneme_list, + int *n_ph, bool resume); + +int MbrolaFill(int length, + bool resume, + int amplitude); + +void MbrolaReset(void); +int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mbrola); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/src/libespeak-ng/speech.c b/src/libespeak-ng/speech.c index f787a4a2..27fc6d81 100644 --- a/src/libespeak-ng/speech.c +++ b/src/libespeak-ng/speech.c @@ -49,6 +49,7 @@ #include #include "dictionary.h" +#include "mbrola.h" #include "readclause.h" #include "synthdata.h" #include "wavegen.h" diff --git a/src/libespeak-ng/speech.h b/src/libespeak-ng/speech.h index fd3d3e75..681f77fb 100644 --- a/src/libespeak-ng/speech.h +++ b/src/libespeak-ng/speech.h @@ -22,6 +22,8 @@ #include +#include "mbrola.h" + #ifdef __cplusplus extern "C" { diff --git a/src/libespeak-ng/synth_mbrola.c b/src/libespeak-ng/synth_mbrola.c index a9c914e6..203c95b5 100644 --- a/src/libespeak-ng/synth_mbrola.c +++ b/src/libespeak-ng/synth_mbrola.c @@ -33,19 +33,24 @@ #include #include "dictionary.h" +#include "mbrola.h" #include "readclause.h" #include "synthdata.h" #include "wavegen.h" + #include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" #include "translate.h" +// included here so tests can find these even without OPT_MBROLA set +int mbrola_delay; +char mbrola_name[20]; + #ifdef INCLUDE_MBROLA -extern int Read4Bytes(FILE *f); extern unsigned char *outbuf; #if defined(_WIN32) || defined(_WIN64) diff --git a/src/libespeak-ng/synthesize.c b/src/libespeak-ng/synthesize.c index 7dc938ad..49f7cab6 100644 --- a/src/libespeak-ng/synthesize.c +++ b/src/libespeak-ng/synthesize.c @@ -34,6 +34,7 @@ #include "dictionary.h" #include "intonation.h" +#include "mbrola.h" #include "setlengths.h" #include "synthdata.h" #include "wavegen.h" @@ -50,9 +51,6 @@ static void SmoothSpect(void); int n_phoneme_list = 0; PHONEME_LIST phoneme_list[N_PHONEME_LIST+1]; -int mbrola_delay; -char mbrola_name[20]; - SPEED_FACTORS speed; static int last_pitch_cmd; diff --git a/src/libespeak-ng/synthesize.h b/src/libespeak-ng/synthesize.h index 843471c2..65c72729 100644 --- a/src/libespeak-ng/synthesize.h +++ b/src/libespeak-ng/synthesize.h @@ -338,15 +338,6 @@ typedef struct { char *filename; } SOUND_ICON; -typedef struct { - int name; - unsigned int next_phoneme; - int mbr_name; - int mbr_name2; - int percent; // percentage length of first component - int control; -} MBROLA_TAB; - typedef struct { int pause_factor; int clause_pause_factor; @@ -464,9 +455,6 @@ extern int echo_tail; extern int echo_amp; extern short echo_buf[N_ECHO_BUF]; -extern int mbrola_delay; -extern char mbrola_name[20]; - void SynthesizeInit(void); int Generate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume); void MakeWave2(PHONEME_LIST *p, int n_ph); @@ -506,12 +494,7 @@ extern double sonicSpeed; extern int n_soundicon_tab; extern SOUND_ICON soundicon_tab[N_SOUNDICON_TAB]; -espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int *srate); espeak_ng_STATUS SetParameter(int parameter, int value, int relative); -int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mbrola); -int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume); -int MbrolaFill(int length, bool resume, int amplitude); -void MbrolaReset(void); void DoEmbedded(int *embix, int sourceix); void DoMarker(int type, int char_posn, int length, int value); void DoPhonemeMarker(int type, int char_posn, int length, char *name);