diff --git a/src/libespeak-ng/compiledata.c b/src/libespeak-ng/compiledata.c index 6ab43b0f..250b78b3 100644 --- a/src/libespeak-ng/compiledata.c +++ b/src/libespeak-ng/compiledata.c @@ -36,7 +36,6 @@ #include #include "error.h" -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" @@ -323,9 +322,9 @@ int proc_addr[N_PROCS]; char proc_names[N_ITEM_STRING+1][N_PROCS]; #define MAX_PROG_BUF 2000 -USHORT *prog_out; -USHORT *prog_out_max; -USHORT prog_buf[MAX_PROG_BUF+20]; +unsigned short *prog_out; +unsigned short *prog_out_max; +unsigned short prog_buf[MAX_PROG_BUF+20]; static espeak_ng_STATUS ReadPhondataManifest(espeak_ng_ERROR_CONTEXT *context) { @@ -442,8 +441,8 @@ STACK stack[N_STACK]; #define N_IF_STACK 12 int if_level; typedef struct { - USHORT *p_then; - USHORT *p_else; + unsigned short *p_then; + unsigned short *p_else; bool returned; } IF_STACK; IF_STACK if_stack[N_IF_STACK]; @@ -1626,7 +1625,7 @@ static int CompileIf(int elif) int bitmap; int brackets; bool not_flag; - USHORT *prog_last_if = NULL; + unsigned short *prog_last_if = NULL; then_count = 2; after_if = true; @@ -1727,7 +1726,7 @@ static int CompileIf(int elif) static void FillThen(int add) { - USHORT *p; + unsigned short *p; int offset; p = if_stack[if_level].p_then; @@ -1755,8 +1754,8 @@ static void FillThen(int add) static int CompileElse(void) { - USHORT *ref; - USHORT *p; + unsigned short *ref; + unsigned short *p; if (if_level < 1) { error("ELSE not expected"); @@ -1794,7 +1793,7 @@ static int CompileElif(void) static int CompileEndif(void) { - USHORT *p; + unsigned short *p; int chain; int offset; @@ -2293,7 +2292,7 @@ static int CompilePhoneme(int compile_phoneme) if (prog_out > prog_buf) { // write out the program for this phoneme fflush(f_phindex); - phoneme_out->program = ftell(f_phindex) / sizeof(USHORT); + phoneme_out->program = ftell(f_phindex) / sizeof(unsigned short); if (f_prog_log != NULL) { phoneme_prog_log.addr = phoneme_out->program; @@ -2302,8 +2301,8 @@ static int CompilePhoneme(int compile_phoneme) } if (compile_phoneme == 0) - proc_addr[n_procs++] = ftell(f_phindex) / sizeof(USHORT); - fwrite(prog_buf, sizeof(USHORT), prog_out - prog_buf, f_phindex); + proc_addr[n_procs++] = ftell(f_phindex) / sizeof(unsigned short); + fwrite(prog_buf, sizeof(unsigned short), prog_out - prog_buf, f_phindex); } return 0; diff --git a/src/libespeak-ng/compiledict.c b/src/libespeak-ng/compiledict.c index 4068265e..2a472f49 100644 --- a/src/libespeak-ng/compiledict.c +++ b/src/libespeak-ng/compiledict.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/src/libespeak-ng/dictionary.c b/src/libespeak-ng/dictionary.c index fb8273bb..5ab68fe4 100644 --- a/src/libespeak-ng/dictionary.c +++ b/src/libespeak-ng/dictionary.c @@ -37,6 +37,14 @@ #include "synthesize.h" #include "translate.h" +typedef struct { + int points; + const char *phonemes; + int end_type; + char *del_fwd; +} MatchRecord; + + int dictionary_skipwords; char dictionary_name[40]; diff --git a/src/libespeak-ng/error.h b/src/libespeak-ng/error.h index 7e0dcc9a..103ba619 100644 --- a/src/libespeak-ng/error.h +++ b/src/libespeak-ng/error.h @@ -18,6 +18,8 @@ #ifndef ESPEAK_NG_ERROR_API #define ESPEAK_NG_ERROR_API +#include + #ifdef __cplusplus extern "C" { diff --git a/src/libespeak-ng/espeak_api.c b/src/libespeak-ng/espeak_api.c index cf0e21af..7e282325 100644 --- a/src/libespeak-ng/espeak_api.c +++ b/src/libespeak-ng/espeak_api.c @@ -27,7 +27,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" diff --git a/src/libespeak-ng/espeak_command.c b/src/libespeak-ng/espeak_command.c index 8ccd23da..f5292d6c 100644 --- a/src/libespeak-ng/espeak_command.c +++ b/src/libespeak-ng/espeak_command.c @@ -25,7 +25,6 @@ #include -#include "speech.h" #include "espeak_command.h" #ifdef USE_ASYNC diff --git a/src/libespeak-ng/espeak_command.h b/src/libespeak-ng/espeak_command.h index 8d1d4d23..78204d2a 100644 --- a/src/libespeak-ng/espeak_command.h +++ b/src/libespeak-ng/espeak_command.h @@ -16,8 +16,10 @@ * along with this program; if not, see: . */ -#ifndef ESPEAK_COMMAND_H -#define ESPEAK_COMMAND_H +#ifndef ESPEAK_NG_COMMAND_H +#define ESPEAK_NG_COMMAND_H + +#include #ifdef __cplusplus extern "C" diff --git a/src/libespeak-ng/event.c b/src/libespeak-ng/event.c index ce03fa7e..d3789458 100644 --- a/src/libespeak-ng/event.c +++ b/src/libespeak-ng/event.c @@ -33,7 +33,6 @@ #include #include -#include "speech.h" #include "event.h" // my_mutex: protects my_thread_is_talking, diff --git a/src/libespeak-ng/event.h b/src/libespeak-ng/event.h index abc263b2..5f47e108 100644 --- a/src/libespeak-ng/event.h +++ b/src/libespeak-ng/event.h @@ -16,9 +16,6 @@ * along with this program; if not, see: . */ -#ifndef EVENT_H -#define EVENT_H - /* Manage events (sentence, word, mark, end,...), is responsible of calling the external callback as soon as the relevant audio sample is played. @@ -39,6 +36,11 @@ */ +#ifndef ESPEAK_NG_EVENT_H +#define ESPEAK_NG_EVENT_H + +#include + #ifdef __cplusplus extern "C" { diff --git a/src/libespeak-ng/fifo.h b/src/libespeak-ng/fifo.h index 7d5c001e..ba5e5526 100644 --- a/src/libespeak-ng/fifo.h +++ b/src/libespeak-ng/fifo.h @@ -16,12 +16,15 @@ * along with this program; if not, see: . */ -#ifndef FIFO_H -#define FIFO_H - // Helps to add espeak commands in a first-in first-out queue // and run them asynchronously. +#ifndef ESPEAK_NG_FIFO_H +#define ESPEAK_NG_FIFO_H + +#include +#include "espeak_command.h" + #ifdef __cplusplus extern "C" { diff --git a/src/libespeak-ng/ieee80.h b/src/libespeak-ng/ieee80.h index 04ca67f4..df4da90f 100644 --- a/src/libespeak-ng/ieee80.h +++ b/src/libespeak-ng/ieee80.h @@ -42,6 +42,7 @@ * conversions, and accommodated conversions involving +/- infinity, * NaN's, and denormalized numbers. */ + #ifndef IEEE_H #define IEEE_H diff --git a/src/libespeak-ng/intonation.c b/src/libespeak-ng/intonation.c index 8384584a..0cd19bc2 100644 --- a/src/libespeak-ng/intonation.c +++ b/src/libespeak-ng/intonation.c @@ -28,7 +28,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" diff --git a/src/libespeak-ng/klatt.c b/src/libespeak-ng/klatt.c index 8b754307..99a82526 100644 --- a/src/libespeak-ng/klatt.c +++ b/src/libespeak-ng/klatt.c @@ -34,7 +34,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" @@ -938,7 +937,7 @@ static int Wavegen_Klatt(int resume) static void SetSynth_Klatt(int length, frame_t *fr1, frame_t *fr2, voice_t *v, int control) { int ix; - DOUBLEX next; + double next; int qix; int cmd; frame_t *fr3; diff --git a/src/libespeak-ng/klatt.h b/src/libespeak-ng/klatt.h index 23934ad5..f8acdb84 100644 --- a/src/libespeak-ng/klatt.h +++ b/src/libespeak-ng/klatt.h @@ -21,6 +21,12 @@ * along with this program; if not, see: . */ +#ifndef ESPEAK_NG_KLATT_H +#define ESPEAK_NG_KLATT_H + +#include "speech.h" +#include "synthesize.h" + #ifdef __cplusplus extern "C" { @@ -161,14 +167,14 @@ typedef struct { int bw; // klatt bandwidth int ap; // parallel amplitude int bp; // parallel bandwidth - DOUBLEX freq1; // floating point versions of the above - DOUBLEX bw1; - DOUBLEX ap1; - DOUBLEX bp1; - DOUBLEX freq_inc; // increment by this every 64 samples - DOUBLEX bw_inc; - DOUBLEX ap_inc; - DOUBLEX bp_inc; + double freq1; // floating point versions of the above + double bw1; + double ap1; + double bp1; + double freq_inc; // increment by this every 64 samples + double bw_inc; + double ap_inc; + double bp_inc; } klatt_peaks_t; void KlattInit(void); @@ -179,3 +185,5 @@ int Wavegen_Klatt2(int length, int resume, frame_t *fr1, frame_t *fr2); #ifdef __cplusplus } #endif + +#endif diff --git a/src/libespeak-ng/mbrowrap.c b/src/libespeak-ng/mbrowrap.c index e9abde41..71d6bb19 100644 --- a/src/libespeak-ng/mbrowrap.c +++ b/src/libespeak-ng/mbrowrap.c @@ -82,7 +82,6 @@ void unload_MBR() #include #include -#include "speech.h" /* * mbrola instance parameters diff --git a/src/libespeak-ng/numbers.c b/src/libespeak-ng/numbers.c index 25db8f24..8c9ad205 100644 --- a/src/libespeak-ng/numbers.c +++ b/src/libespeak-ng/numbers.c @@ -31,7 +31,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" diff --git a/src/libespeak-ng/phoneme.h b/src/libespeak-ng/phoneme.h index 0f18ef80..fd070763 100644 --- a/src/libespeak-ng/phoneme.h +++ b/src/libespeak-ng/phoneme.h @@ -17,6 +17,11 @@ * along with this program; if not, see: . */ +#ifndef ESPEAK_NG_PHONEME_H +#define ESPEAK_NG_PHONEME_H + +#include + #ifdef __cplusplus extern "C" { @@ -291,3 +296,5 @@ extern int phoneme_tab_number; #ifdef __cplusplus } #endif + +#endif diff --git a/src/libespeak-ng/phonemelist.c b/src/libespeak-ng/phonemelist.c index 3d8d3e23..60ced1d1 100644 --- a/src/libespeak-ng/phonemelist.c +++ b/src/libespeak-ng/phonemelist.c @@ -29,7 +29,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" diff --git a/src/libespeak-ng/setlengths.c b/src/libespeak-ng/setlengths.c index bf879f63..831e2f51 100644 --- a/src/libespeak-ng/setlengths.c +++ b/src/libespeak-ng/setlengths.c @@ -28,7 +28,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" diff --git a/src/libespeak-ng/sintab.h b/src/libespeak-ng/sintab.h index 4a84d12d..628a81d3 100644 --- a/src/libespeak-ng/sintab.h +++ b/src/libespeak-ng/sintab.h @@ -17,6 +17,9 @@ * along with this program; if not, see: . */ +#ifndef ESPEAK_NG_SINTAB_H +#define ESPEAK_NG_SINTAB_H + #ifdef __cplusplus extern "C" { @@ -284,3 +287,5 @@ short int sin_tab[2048] = { #ifdef __cplusplus } #endif + +#endif diff --git a/src/libespeak-ng/spect.c b/src/libespeak-ng/spect.c index e468dfd6..dc027df5 100644 --- a/src/libespeak-ng/spect.c +++ b/src/libespeak-ng/spect.c @@ -30,7 +30,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" @@ -193,7 +192,7 @@ static espeak_ng_STATUS LoadFrame(SpectFrame *frame, FILE *stream, int file_form } } - spect_data = malloc(sizeof(USHORT) * frame->nx); + spect_data = malloc(sizeof(unsigned short) * frame->nx); if (spect_data == NULL) return ENOMEM; diff --git a/src/libespeak-ng/spect.h b/src/libespeak-ng/spect.h index f4f1c883..d04b206b 100644 --- a/src/libespeak-ng/spect.h +++ b/src/libespeak-ng/spect.h @@ -17,6 +17,13 @@ * along with this program; if not, see: . */ +#ifndef ESPEAK_NG_SPECT_H +#define ESPEAK_NG_SPECT_H + +#include +#include "synthesize.h" +#include "speech.h" + #ifdef __cplusplus extern "C" { @@ -98,7 +105,7 @@ typedef struct { unsigned short nx; short markers; int max_y; - USHORT *spect; // sqrt of harmonic amplitudes, 1-nx at 'pitch' + unsigned short *spect; // sqrt of harmonic amplitudes, 1-nx at 'pitch' short klatt_param[N_KLATTP2]; @@ -133,3 +140,5 @@ espeak_ng_STATUS LoadSpectSeq(SpectSeq *spect, const char *filename); #ifdef __cplusplus } #endif + +#endif diff --git a/src/libespeak-ng/speech.h b/src/libespeak-ng/speech.h index 6f703b87..fd3d3e75 100644 --- a/src/libespeak-ng/speech.h +++ b/src/libespeak-ng/speech.h @@ -17,8 +17,10 @@ * along with this program; if not, see: . */ -#ifndef SPEECH_H -#define SPEECH_H +#ifndef ESPEAK_NG_SPEECH_H +#define ESPEAK_NG_SPEECH_H + +#include #ifdef __cplusplus extern "C" @@ -55,10 +57,6 @@ extern "C" #define PATH_ESPEAK_DATA "/usr/share/espeak-ng-data" #endif -typedef unsigned short USHORT; -typedef unsigned char UCHAR; -typedef double DOUBLEX; - typedef struct { const char *mnem; int value; diff --git a/src/libespeak-ng/ssml.h b/src/libespeak-ng/ssml.h index 5399542a..f47f213c 100644 --- a/src/libespeak-ng/ssml.h +++ b/src/libespeak-ng/ssml.h @@ -21,6 +21,11 @@ #ifndef ESPEAK_NG_SSML_API #define ESPEAK_NG_SSML_API +#include +#include + +#include + #ifdef __cplusplus extern "C" { diff --git a/src/libespeak-ng/synthdata.c b/src/libespeak-ng/synthdata.c index 09d1def6..81ce99d4 100644 --- a/src/libespeak-ng/synthdata.c +++ b/src/libespeak-ng/synthdata.c @@ -47,7 +47,7 @@ int current_phoneme_table; PHONEME_TAB *phoneme_tab[N_PHONEME_TAB]; unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited -USHORT *phoneme_index = NULL; +unsigned short *phoneme_index = NULL; char *phondata_ptr = NULL; unsigned char *wavefile_data = NULL; static unsigned char *phoneme_tab_data = NULL; @@ -498,7 +498,7 @@ static int CountVowelPosition(PHONEME_LIST *plist) return count; } -static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist, USHORT *p_prog, WORD_PH_DATA *worddata) +static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist, unsigned short *p_prog, WORD_PH_DATA *worddata) { int which; int ix; @@ -693,9 +693,9 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist, return false; } -static void SwitchOnVowelType(PHONEME_LIST *plist, PHONEME_DATA *phdata, USHORT **p_prog, int instn_type) +static void SwitchOnVowelType(PHONEME_LIST *plist, PHONEME_DATA *phdata, unsigned short **p_prog, int instn_type) { - USHORT *prog; + unsigned short *prog; int voweltype; signed char x; @@ -716,7 +716,7 @@ static void SwitchOnVowelType(PHONEME_LIST *plist, PHONEME_DATA *phdata, USHORT *p_prog += 12; } -int NumInstnWords(USHORT *prog) +int NumInstnWords(unsigned short *prog) { int instn; int instn2; @@ -769,8 +769,8 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_ // bit 8: change phonemes PHONEME_TAB *ph; - USHORT *prog; - USHORT instn; + unsigned short *prog; + unsigned short instn; int instn2; int or_flag; bool truth; @@ -782,7 +782,7 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_ #define N_RETURN 10 int n_return = 0; - USHORT *return_addr[N_RETURN]; // return address stack + unsigned short *return_addr[N_RETURN]; // return address stack ph = plist->ph; diff --git a/src/libespeak-ng/synthesize.c b/src/libespeak-ng/synthesize.c index 0ce0dfa2..194d5343 100644 --- a/src/libespeak-ng/synthesize.c +++ b/src/libespeak-ng/synthesize.c @@ -32,7 +32,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" diff --git a/src/libespeak-ng/synthesize.h b/src/libespeak-ng/synthesize.h index 826b237f..d5b3a50b 100644 --- a/src/libespeak-ng/synthesize.h +++ b/src/libespeak-ng/synthesize.h @@ -17,13 +17,20 @@ * along with this program; if not, see: . */ -#include +#ifndef ESPEAK_NG_SYNTHESIZE_H +#define ESPEAK_NG_SYNTHESIZE_H #ifdef __cplusplus extern "C" { #endif +#include +#include +#include +#include "phoneme.h" +#include "voice.h" + #define espeakINITIALIZE_PHONEME_IPA 0x0002 // move this to speak_lib.h, after eSpeak version 1.46.02 #define N_PHONEME_LIST 1000 // enough for source[N_TR_SOURCE] full of text, else it will truncate @@ -128,14 +135,14 @@ typedef struct { int height; // height<<15 int left; // Hz<<16 int right; // Hz<<16 - DOUBLEX freq1; // floating point versions of the above - DOUBLEX height1; - DOUBLEX left1; - DOUBLEX right1; - DOUBLEX freq_inc; // increment by this every 64 samples - DOUBLEX height_inc; - DOUBLEX left_inc; - DOUBLEX right_inc; + double freq1; // floating point versions of the above + double height1; + double left1; + double right1; + double freq_inc; // increment by this every 64 samples + double height_inc; + double left_inc; + double right_inc; } wavegen_peaks_t; typedef struct { @@ -552,10 +559,12 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L int PauseLength(int pause, int control); int LookupPhonemeTable(const char *name); unsigned char *GetEnvelope(int index); -int NumInstnWords(USHORT *prog); +int NumInstnWords(unsigned short *prog); void InitBreath(void); #ifdef __cplusplus } #endif + +#endif diff --git a/src/libespeak-ng/tr_languages.c b/src/libespeak-ng/tr_languages.c index 364614e9..2886f16a 100644 --- a/src/libespeak-ng/tr_languages.c +++ b/src/libespeak-ng/tr_languages.c @@ -30,7 +30,6 @@ #include #include -#include "speech.h" #include "phoneme.h" #include "voice.h" #include "synthesize.h" diff --git a/src/libespeak-ng/translate.h b/src/libespeak-ng/translate.h index 2016b2d5..e5e2b2cb 100644 --- a/src/libespeak-ng/translate.h +++ b/src/libespeak-ng/translate.h @@ -17,6 +17,16 @@ * along with this program; if not, see: . */ +#ifndef ESPEAK_NG_TRANSLATE_H +#define ESPEAK_NG_TRANSLATE_H + +#include + +#include +#include + +#include "synthesize.h" + #ifdef __cplusplus extern "C" { @@ -257,13 +267,6 @@ int clause_type_from_codepoint(uint32_t c); typedef const char *constcharptr; -typedef struct { - int points; - const char *phonemes; - int end_type; - char *del_fwd; -} MatchRecord; - // used to mark words with the source[] buffer typedef struct { unsigned int flags; @@ -579,16 +582,6 @@ typedef struct { int suffix_add_e; // replace a suffix (which has the SUFX_E flag) with this character } LANGUAGE_OPTIONS; -// a parameter of ChangePhonemes() -typedef struct { - int flags; - unsigned char stress; // stress level of this vowel - unsigned char stress_highest; // the highest stress level of a vowel in this word - unsigned char n_vowels; // number of vowels in the word - unsigned char vowel_this; // syllable number of this vowel (counting from 1) - unsigned char vowel_stressed; // syllable number of the highest stressed vowel -} CHANGEPH; - typedef struct { LANGUAGE_OPTIONS langopts; int translator_name; @@ -759,7 +752,6 @@ void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len); char *DecodeRule(const char *group_chars, int group_length, char *rule, int control); void MakePhonemeList(Translator *tr, int post_pause, bool new_sentence); -int ChangePhonemes_ru(Translator *tr, PHONEME_LIST2 *phlist, int n_ph, int index, PHONEME_TAB *ph, CHANGEPH *ch); void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags); void AppendPhonemes(Translator *tr, char *string, int size, const char *ph); @@ -784,3 +776,5 @@ extern FILE *f_trans; // for logging #ifdef __cplusplus } #endif + +#endif diff --git a/src/libespeak-ng/voice.h b/src/libespeak-ng/voice.h index ff7d7a79..d33c8ca7 100644 --- a/src/libespeak-ng/voice.h +++ b/src/libespeak-ng/voice.h @@ -17,6 +17,11 @@ * along with this program; if not, see: . */ +#ifndef ESPEAK_NG_VOICE_H +#define ESPEAK_NG_VOICE_H + +#include + #ifdef __cplusplus extern "C" { @@ -73,7 +78,7 @@ typedef struct { } voice_t; // percentages shown to user, ix=N_PEAKS means ALL peaks -extern USHORT voice_pcnt[N_PEAKS+1][3]; +extern unsigned short voice_pcnt[N_PEAKS+1][3]; extern espeak_VOICE current_voice_selected; @@ -93,3 +98,5 @@ void FreeVoiceList(void); #ifdef __cplusplus } #endif + +#endif diff --git a/src/libespeak-ng/wavegen.c b/src/libespeak-ng/wavegen.c index 027a8d22..ab833cf8 100644 --- a/src/libespeak-ng/wavegen.c +++ b/src/libespeak-ng/wavegen.c @@ -32,10 +32,10 @@ #include #include +#include "synthesize.h" #include "speech.h" #include "phoneme.h" #include "voice.h" -#include "synthesize.h" #ifdef INCLUDE_KLATT #include "klatt.h" @@ -1151,7 +1151,7 @@ static void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t * return; int ix; - DOUBLEX next; + double next; int length2; int length4; int qix;