From 95dafb3fea9f98566b25b3f6ba6f114e8f18e3f8 Mon Sep 17 00:00:00 2001 From: martin-s Date: Thu, 24 Sep 2009 18:21:19 +0000 Subject: Fix:support_espeak:Removed cppisms git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2608 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/support/espeak/compiledict.c | 24 +++++++++++--------- navit/support/espeak/dictionary.c | 34 ++++++++++++++-------------- navit/support/espeak/klatt.c | 20 ++++++++--------- navit/support/espeak/readclause.c | 46 ++++++++++++++++++++------------------ navit/support/espeak/setlengths.c | 6 ++--- navit/support/espeak/speak.c | 14 +++++++++--- navit/support/espeak/speech.h | 3 +-- navit/support/espeak/synthdata.c | 8 +++---- navit/support/espeak/synthesize.c | 20 ++++++++--------- navit/support/espeak/translate.c | 28 +++++++++++------------ navit/support/espeak/translate.h | 18 +++++++-------- navit/support/espeak/voices.c | 11 ++++----- navit/support/espeak/wavegen.c | 24 ++++++++++---------- 13 files changed, 134 insertions(+), 122 deletions(-) (limited to 'navit/support') diff --git a/navit/support/espeak/compiledict.c b/navit/support/espeak/compiledict.c index 86a5d14d6..8fc6ab396 100755 --- a/navit/support/espeak/compiledict.c +++ b/navit/support/espeak/compiledict.c @@ -711,7 +711,7 @@ static char group_name[LEN_GROUP_NAME+1]; -static void copy_rule_string(char *string, int &state) +static void copy_rule_string(char *string, int *state) {//=================================================== // state 0: conditional, 1=pre, 2=match, 3=post, 4=phonemes static char *outbuf[5] = {rule_cond, rule_pre, rule_match, rule_post, rule_phonemes}; @@ -727,8 +727,8 @@ static void copy_rule_string(char *string, int &state) if(string[0] == 0) return; - output = outbuf[state]; - if(state==4) + output = outbuf[*state]; + if(*state==4) { // append to any previous phoneme string, i.e. allow spaces in the phoneme string len = strlen(rule_phonemes); @@ -754,7 +754,7 @@ static void copy_rule_string(char *string, int &state) literal = 1; } - if((state==1) || (state==3)) + if(((*state)==1) || ((*state)==3)) { // replace special characters (note: 'E' is reserved for a replaced silent 'e') if(literal == 0) @@ -774,7 +774,7 @@ static void copy_rule_string(char *string, int &state) case 'H': case 'F': case 'G': - if(state == 1) + if((*state) == 1) { // pre-rule, put the number before the RULE_LETTERGP; output[ix++] = lettergp_letters[c-'A'] + 'A'; @@ -846,7 +846,7 @@ static void copy_rule_string(char *string, int &state) error_count++; } c += 'A'; - if(state == 1) + if((*state) == 1) { // pre-rule, put the group number before the RULE_LETTERGP command output[ix++] = c; @@ -916,7 +916,7 @@ static void copy_rule_string(char *string, int &state) if(c == 0) break; } - state = next_state[state]; + *state = next_state[*state]; } // end of copy_rule_string @@ -956,14 +956,14 @@ static char *compile_rule(char *input) *p = 0; state = 1; pre_bracket = 1; - copy_rule_string(buf,state); + copy_rule_string(buf,&state); p = buf; break; case '(': // start of suffix section *p = 0; state = 2; - copy_rule_string(buf,state); + copy_rule_string(buf,&state); state = 3; p = buf; break; @@ -972,14 +972,14 @@ static char *compile_rule(char *input) case '\r': case 0: // end of line *p = 0; - copy_rule_string(buf,state); + copy_rule_string(buf,&state); finish=1; break; case '\t': // end of section section case ' ': *p = 0; - copy_rule_string(buf,state); + copy_rule_string(buf,&state); p = buf; break; @@ -1563,7 +1563,9 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp) fputc(0,f_out); fclose(f_temp); +#if 0 remove(fname_temp); +#endif fprintf(f_log,"\t%d rules, %d groups\n\n",count,n_rgroups); return(0); diff --git a/navit/support/espeak/dictionary.c b/navit/support/espeak/dictionary.c index a69d4d2ed..85a8c518a 100755 --- a/navit/support/espeak/dictionary.c +++ b/navit/support/espeak/dictionary.c @@ -839,7 +839,7 @@ return(0); -static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char *vowel_stress, int &vowel_count, int &stressed_syllable, int control) +static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char *vowel_stress, int *vowel_count, int *stressed_syllable, int control) {//==================================================================================================================================================== // control = 1, set stress to 1 for forced unstressed vowels unsigned char phcode; @@ -866,7 +866,7 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char { /* primary stress on preceeding vowel */ j = count - 1; - while((j > 0) && (stressed_syllable == 0) && (vowel_stress[j] < 4)) + while((j > 0) && (*stressed_syllable == 0) && (vowel_stress[j] < 4)) { if(vowel_stress[j] != 1) { @@ -892,7 +892,7 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char } else { - if((ph->std_length < 4) || (stressed_syllable == 0)) + if((ph->std_length < 4) || (*stressed_syllable == 0)) { stress = ph->std_length; @@ -933,14 +933,14 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char *ph_out = 0; /* has the position of the primary stress been specified by $1, $2, etc? */ - if(stressed_syllable > 0) + if(*stressed_syllable > 0) { - if(stressed_syllable >= count) - stressed_syllable = count-1; // the final syllable + if(*stressed_syllable >= count) + *stressed_syllable = count-1; // the final syllable - vowel_stress[stressed_syllable] = 4; + vowel_stress[*stressed_syllable] = 4; max_stress = 4; - primary_posn = stressed_syllable; + primary_posn = *stressed_syllable; } if(max_stress == 5) @@ -965,8 +965,8 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char max_stress = 4; } - stressed_syllable = primary_posn; - vowel_count = count; + *stressed_syllable = primary_posn; + *vowel_count = count; return(max_stress); } // end of GetVowelStress @@ -987,7 +987,7 @@ void ChangeWordStress(Translator *tr, char *word, int new_stress) unsigned char vowel_stress[N_WORD_PHONEMES/2]; strcpy((char *)phonetic,word); - max_stress = GetVowelStress(tr, phonetic, vowel_stress, vowel_count, stressed_syllable, 0); + max_stress = GetVowelStress(tr, phonetic, vowel_stress, &vowel_count, &stressed_syllable, 0); if(new_stress >= 4) { @@ -1030,7 +1030,7 @@ void ChangeWordStress(Translator *tr, char *word, int new_stress) -void SetWordStress(Translator *tr, char *output, unsigned int &dictionary_flags, int tonic, int prev_stress) +void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int prev_stress) {//========================================================================================================= /* Guess stress pattern of word. This is language specific @@ -1099,21 +1099,21 @@ void SetWordStress(Translator *tr, char *output, unsigned int &dictionary_flags, max_output = output + (N_WORD_PHONEMES-3); /* check for overrun */ // any stress position marked in the xx_list dictionary ? - stressed_syllable = dictionary_flags & 0x7; - if(dictionary_flags & 0x8) + stressed_syllable = (*dictionary_flags) & 0x7; + if((*dictionary_flags) & 0x8) { // this indicates a word without a primary stress - stressed_syllable = dictionary_flags & 0x3; + stressed_syllable = (*dictionary_flags) & 0x3; unstressed_word = 1; } - max_stress = GetVowelStress(tr, phonetic, vowel_stress, vowel_count, stressed_syllable, 1); + max_stress = GetVowelStress(tr, phonetic, vowel_stress, &vowel_count, &stressed_syllable, 1); if((max_stress == 0) && (tr->langopts.stress_flags & 1) && (vowel_count == 2)) { // option: don't stress monosyllables except at end-of-clause vowel_stress[1] = 1; - dictionary_flags |= FLAG_STRESS_END2; + (*dictionary_flags) |= FLAG_STRESS_END2; } // heavy or light syllables diff --git a/navit/support/espeak/klatt.c b/navit/support/espeak/klatt.c index a10d00eab..8cdbf782b 100644 --- a/navit/support/espeak/klatt.c +++ b/navit/support/espeak/klatt.c @@ -468,8 +468,8 @@ static int parwave(klatt_frame_ptr frame) temp = 32767.0; } - *out_ptr++ = int(temp); // **JSD - *out_ptr++ = int(temp) >> 8; + *out_ptr++ = (int)(temp); // **JSD + *out_ptr++ = (int)(temp) >> 8; sample_count++; if(out_ptr >= out_end) { @@ -959,7 +959,7 @@ static double DBtoLIN(long dB) return(0); } - return(double(amptable[dB]) * 0.001); + return((double)(amptable[dB]) * 0.001); } @@ -1035,7 +1035,7 @@ int Wavegen_Klatt(int resume) for(ix=0; ix < N_KLATTP; ix++) { klattp1[ix] += klattp_inc[ix]; - klattp[ix] = int(klattp1[ix]); + klattp[ix] = (int)(klattp1[ix]); } for(ix=0; ix<=6; ix++) @@ -1174,7 +1174,7 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v else { klattp1[ix] = klattp[ix] = fr1->klattp[ix]; - klattp_inc[ix] = double((fr2->klattp[ix] - klattp[ix]) * STEPSIZE)/length; + klattp_inc[ix] = (double)((fr2->klattp[ix] - klattp[ix]) * STEPSIZE)/length; } // get klatt parameter adjustments for the voice @@ -1187,7 +1187,7 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v for(ix=1; ix < 6; ix++) { peaks[ix].freq1 = (fr1->ffreq[ix] * v->freq[ix] / 256.0) + v->freqadd[ix]; - peaks[ix].freq = int(peaks[ix].freq1); + peaks[ix].freq = (int)(peaks[ix].freq1); next = (fr2->ffreq[ix] * v->freq[ix] / 256.0) + v->freqadd[ix]; peaks[ix].freq_inc = ((next - peaks[ix].freq1) * STEPSIZE) / length; @@ -1195,7 +1195,7 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v { // klatt bandwidth for f1, f2, f3 (others are fixed) peaks[ix].bw1 = fr1->bw[ix] * 2; - peaks[ix].bw = int(peaks[ix].bw1); + peaks[ix].bw = (int)(peaks[ix].bw1); next = fr2->bw[ix] * 2; peaks[ix].bw_inc = ((next - peaks[ix].bw1) * STEPSIZE) / length; } @@ -1203,7 +1203,7 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v // nasal zero frequency peaks[0].freq1 = fr1->klattp[KLATT_FNZ] * 2; - peaks[0].freq = int(peaks[0].freq1); + peaks[0].freq = (int)(peaks[0].freq1); next = fr2->klattp[KLATT_FNZ] * 2; peaks[0].freq_inc = ((next - peaks[0].freq1) * STEPSIZE) / length; @@ -1217,12 +1217,12 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v for(ix=1; ix < 7; ix++) { peaks[ix].bp1 = fr1->klatt_bp[ix] * 4; // parallel bandwidth - peaks[ix].bp = int(peaks[ix].bp1); + peaks[ix].bp = (int)(peaks[ix].bp1); next = fr2->klatt_bp[ix] * 2; peaks[ix].bp_inc = ((next - peaks[ix].bp1) * STEPSIZE) / length; peaks[ix].ap1 = fr1->klatt_ap[ix]; // parallal amplitude - peaks[ix].ap = int(peaks[ix].ap1); + peaks[ix].ap = (int)(peaks[ix].ap1); next = fr2->klatt_ap[ix] * 2; peaks[ix].ap_inc = ((next - peaks[ix].ap1) * STEPSIZE) / length; } diff --git a/navit/support/espeak/readclause.c b/navit/support/espeak/readclause.c index 8765d7242..b8d302a27 100644 --- a/navit/support/espeak/readclause.c +++ b/navit/support/espeak/readclause.c @@ -41,7 +41,7 @@ #include #define N_XML_BUF 256 - +#define double(x) ((double)(x)) static const char *xmlbase = ""; // base URL from static int namedata_ix=0; @@ -557,7 +557,7 @@ static const char *LookupSpecial(Translator *tr, const char *string, char* text_ if(LookupDictList(tr,&string1,phonemes,flags,0,NULL)) { - SetWordStress(tr, phonemes, flags[0], -1, 0); + SetWordStress(tr, phonemes, &flags[0], -1, 0); DecodePhonemes(phonemes,phonemes2); sprintf(text_out,"[[%s]]",phonemes2); option_phoneme_input |= 2; @@ -627,14 +627,14 @@ static const char *LookupCharName(Translator *tr, int c) { if(lang_name) { - SetWordStress(translator2, phonemes, flags[0], -1, 0); + SetWordStress(translator2, phonemes, &flags[0], -1, 0); DecodePhonemes(phonemes,phonemes2); sprintf(buf,"[[_^_%s %s _^_%s]]","en",phonemes2,WordToString2(tr->translator_name)); SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table } else { - SetWordStress(tr, phonemes, flags[0], -1, 0); + SetWordStress(tr, phonemes, &flags[0], -1, 0); DecodePhonemes(phonemes,phonemes2); sprintf(buf,"[[%s]] ",phonemes2); } @@ -749,7 +749,9 @@ static int LoadSoundFile(const char *fname, int index) } fread(p,length,1,f); fclose(f); +#if 0 remove(fname_temp); +#endif ip = (int *)(&p[40]); soundicon_tab[index].length = (*ip) / 2; // length in samples @@ -1002,7 +1004,7 @@ static const char *VoiceFromStack() -static void ProcessParamStack(char *outbuf, int &outix) +static void ProcessParamStack(char *outbuf, int *outix) {//==================================================== // Set the speech parameters from the parameter stack int param; @@ -1051,8 +1053,8 @@ static void ProcessParamStack(char *outbuf, int &outix) } speech_parameters[param] = new_parameters[param]; - strcpy(&outbuf[outix],buf); - outix += strlen(buf); + strcpy(&outbuf[*outix],buf); + (*outix) += strlen(buf); } } } // end of ProcessParamStack @@ -1076,7 +1078,7 @@ static PARAM_STACK *PushParamStack(int tag_type) } // end of PushParamStack -static void PopParamStack(int tag_type, char *outbuf, int &outix) +static void PopParamStack(int tag_type, char *outbuf, int *outix) {//============================================================== // unwind the stack up to and including the previous tag of this type int ix; @@ -1466,7 +1468,7 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp) -static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outbuf, int self_closing) +static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, int self_closing) {//================================================================================================== // xml_buf is the tag and attributes with a zero terminator in place of the original '>' // returns a clause terminator value. @@ -1647,15 +1649,15 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outb } sprintf(buf,"%c%dY",CTRL_EMBEDDED,value); - strcpy(&outbuf[outix],buf); - outix += strlen(buf); + strcpy(&outbuf[*outix],buf); + (*outix) += strlen(buf); sayas_mode = value; // punctuation doesn't end clause during SAY-AS break; case SSML_SAYAS + SSML_CLOSE: - outbuf[outix++] = CTRL_EMBEDDED; - outbuf[outix++] = 'Y'; + outbuf[(*outix)++] = CTRL_EMBEDDED; + outbuf[(*outix)++] = 'Y'; sayas_mode = 0; break; @@ -1664,7 +1666,7 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outb { // use the alias rather than the text ignore_text = 1; - outix += attrcopy_utf8(&outbuf[outix],attr1,n_outbuf-outix); + (*outix) += attrcopy_utf8(&outbuf[*outix],attr1,n_outbuf-*outix); } break; @@ -1694,8 +1696,8 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outb if((index = AddNameData(buf,0)) >= 0) { sprintf(buf,"%c%dM",CTRL_EMBEDDED,index); - strcpy(&outbuf[outix],buf); - outix += strlen(buf); + strcpy(&outbuf[*outix],buf); + (*outix) += strlen(buf); } } break; @@ -1722,8 +1724,8 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outb if(index >= 0) { sprintf(buf,"%c%dI",CTRL_EMBEDDED,index); - strcpy(&outbuf[outix],buf); - outix += strlen(buf); + strcpy(&outbuf[*outix],buf); + (*outix) += strlen(buf); sp->parameter[espeakSILENCE] = 1; } } @@ -1735,8 +1737,8 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outb if(uri_callback(1,uri,xmlbase) == 0) { sprintf(buf,"%c%dU",CTRL_EMBEDDED,index); - strcpy(&outbuf[outix],buf); - outix += strlen(buf); + strcpy(&outbuf[*outix],buf); + (*outix) += strlen(buf); sp->parameter[espeakSILENCE] = 1; } } @@ -1763,8 +1765,8 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int &outix, int n_outb if(value < 3) { // adjust prepause on the following word - sprintf(&outbuf[outix],"%c%dB",CTRL_EMBEDDED,value); - outix += 3; + sprintf(&outbuf[*outix],"%c%dB",CTRL_EMBEDDED,value); + (*outix) += 3; terminator = 0; } value = break_value[value]; diff --git a/navit/support/espeak/setlengths.c b/navit/support/espeak/setlengths.c index fee14b66c..ed4421bf9 100755 --- a/navit/support/espeak/setlengths.c +++ b/navit/support/espeak/setlengths.c @@ -247,14 +247,14 @@ void SetParameter(int parameter, int value, int relative) -static void DoEmbedded2(int &embix) +static void DoEmbedded2(int *embix) {//================================ // There were embedded commands in the text at this point unsigned int word; do { - word = embedded_list[embix++]; + word = embedded_list[(*embix)++]; if((word & 0x1f) == EMBED_S) { @@ -305,7 +305,7 @@ void CalcLengths(Translator *tr) if(p->synthflags & SFLAG_EMBEDDED) { - DoEmbedded2(embedded_ix); + DoEmbedded2(&embedded_ix); } type = p->type; diff --git a/navit/support/espeak/speak.c b/navit/support/espeak/speak.c index 8ad86ca73..ab33a867b 100755 --- a/navit/support/espeak/speak.c +++ b/navit/support/espeak/speak.c @@ -340,12 +340,14 @@ static void init_path(char *argv0, char *path_specified) char *env; unsigned char buf[sizeof(path_home)-12]; +#if 0 if(((env = getenv("ESPEAK_DATA_PATH")) != NULL) && ((strlen(env)+12) < sizeof(path_home))) { sprintf(path_home,"%s\\espeak-data",env); if(GetFileLength(path_home) == -2) return; // an espeak-data directory exists in the directory specified by environment variable } +#endif strcpy(path_home,argv0); if((p = strrchr(path_home,'\\')) != NULL) @@ -368,13 +370,16 @@ static void init_path(char *argv0, char *path_specified) strcpy(path_home,PATH_ESPEAK_DATA); #else char *env; +#if 0 if((env = getenv("ESPEAK_DATA_PATH")) != NULL) { snprintf(path_home,sizeof(path_home),"%s/espeak-data",env); if(GetFileLength(path_home) == -2) return; // an espeak-data directory exists } +#endif +#if 0 snprintf(path_home,sizeof(path_home),"%s/espeak-data",getenv("HOME")); if(access(path_home,R_OK) != 0) { @@ -382,6 +387,7 @@ static void init_path(char *argv0, char *path_specified) } #endif #endif +#endif } @@ -396,12 +402,14 @@ static int initialise(void) #ifdef PLATFORM_RISCOS setlocale(LC_CTYPE,"ISO8859-1"); #else +#if 0 if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL) { if(setlocale(LC_CTYPE,"UTF-8") == NULL) setlocale(LC_CTYPE,""); } #endif +#endif WavegenInit(22050,0); // 22050 @@ -428,12 +436,12 @@ static int initialise(void) static void StopSpeak(int unused) {//============================== - signal(SIGINT,SIG_IGN); +// signal(SIGINT,SIG_IGN); // DEBUG // printf("\n*** Interrupting speech output (use Ctrl-D to actually quit).\n"); fflush(stdout); SpeakNextClause(NULL,NULL,5); - signal(SIGINT,StopSpeak); +// signal(SIGINT,StopSpeak); } // end of StopSpeak() #ifdef NEED_GETOPT @@ -566,7 +574,7 @@ int main (int argc, char **argv) } } #else - while(true) + while(1) { c = getopt_long (argc, argv, "a:b:f:g:hk:l:p:qs:v:w:xXmz", // NOTE: also change arg_opts to indicate which commands have a numeric value long_options, &option_index); diff --git a/navit/support/espeak/speech.h b/navit/support/espeak/speech.h index 3a0007a54..cec86cf68 100755 --- a/navit/support/espeak/speech.h +++ b/navit/support/espeak/speech.h @@ -27,13 +27,12 @@ #define ARCH_BIG #endif -#define PLATFORM_POSIX +/* #define PLATFORM_POSIX */ #define PATHSEP '/' // USE_PORTAUDIO or USE_PULSEAUDIO are now defined in the makefile //#define USE_PORTAUDIO //#define USE_PULSEAUDIO #define USE_NANOSLEEP -#define __cdecl #define ESPEAK_API extern "C" #ifdef LIBRARY diff --git a/navit/support/espeak/synthdata.c b/navit/support/espeak/synthdata.c index f348e6b3b..4f8234beb 100755 --- a/navit/support/espeak/synthdata.c +++ b/navit/support/espeak/synthdata.c @@ -65,7 +65,7 @@ int vowel_transition[4]; int vowel_transition0; int vowel_transition1; -int FormantTransition2(frameref_t *seq, int &n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which); +int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which); @@ -438,7 +438,7 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, PHONEME_TAB *prev_ph, PHONEME_TAB if((*match_level == 0) || (next_ph->type == phNASAL)) { LookupSound(next_ph,this_ph,1,NULL,1); - seq_len_adjust += FormantTransition2(frames,nf,vowel_transition[2],vowel_transition[3],next_ph,which); + seq_len_adjust += FormantTransition2(frames,&nf,vowel_transition[2],vowel_transition[3],next_ph,which); } else if(next_ph->phflags == phVOWEL2) @@ -448,14 +448,14 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, PHONEME_TAB *prev_ph, PHONEME_TAB { next2_ph = plist[2].ph; LookupSound(next2_ph,next_ph,1,NULL,1); - seq_len_adjust += FormantTransition2(frames,nf,vowel_transition[2],vowel_transition[3],next2_ph,which); + seq_len_adjust += FormantTransition2(frames,&nf,vowel_transition[2],vowel_transition[3],next2_ph,which); } } } else { if(*match_level == 0) - seq_len_adjust = FormantTransition2(frames,nf,vowel_transition0,vowel_transition1,prev_ph,which); + seq_len_adjust = FormantTransition2(frames,&nf,vowel_transition0,vowel_transition1,prev_ph,which); } } diff --git a/navit/support/espeak/synthesize.c b/navit/support/espeak/synthesize.c index 3709d8341..3a48b1d72 100755 --- a/navit/support/espeak/synthesize.c +++ b/navit/support/espeak/synthesize.c @@ -69,7 +69,7 @@ SOUND_ICON soundicon_tab[N_SOUNDICON_TAB]; #define VOWEL_FRONT_LENGTH 50 - +#define long(x) ((long)(x)) // a dummy phoneme_list entry which looks like a pause static PHONEME_LIST next_pause; @@ -491,7 +491,7 @@ static int VowelCloseness(frame_t *fr) } -int FormantTransition2(frameref_t *seq, int &n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which) +int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which) {//============================================================================================================================== int ix; int formant; @@ -517,7 +517,7 @@ static short vcolouring[N_VCOLOUR][5] = { frame_t *fr = NULL; - if(n_frames < 2) + if(*n_frames < 2) return(0); len = (data1 & 0x3f) * 2; @@ -591,8 +591,8 @@ if(voice->klattv[0]) if(flags & 8) { - fr = CopyFrame(seq[n_frames-1].frame,0); - seq[n_frames-1].frame = fr; + fr = CopyFrame(seq[*n_frames-1].frame,0); + seq[*n_frames-1].frame = fr; rms = RMS_GLOTTAL1; // degree of glottal-stop effect depends on closeness of vowel (indicated by f1 freq) @@ -600,7 +600,7 @@ if(voice->klattv[0]) } else { - fr = DuplicateLastFrame(seq,n_frames++,len); + fr = DuplicateLastFrame(seq,(*n_frames)++,len); if(len > 36) seq_len_adjust += (len - 36); @@ -614,7 +614,7 @@ if(voice->klattv[0]) if((vcolour > 0) && (vcolour <= N_VCOLOUR)) { - for(ix=0; ix> 8; command = word & 0x7f; @@ -1171,7 +1171,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) if(p->synthflags & SFLAG_EMBEDDED) { - DoEmbedded(embedded_ix, p->sourceix); + DoEmbedded(&embedded_ix, p->sourceix); } if(p->newword) diff --git a/navit/support/espeak/translate.c b/navit/support/espeak/translate.c index 56cdd4943..4891644cd 100755 --- a/navit/support/espeak/translate.c +++ b/navit/support/espeak/translate.c @@ -1069,7 +1069,7 @@ strcpy(phonemes2,phonemes); { char *p; // German, keep a secondary stress on the stem - SetWordStress(tr, phonemes, dictionary_flags[0], 3, 0); + SetWordStress(tr, phonemes, &dictionary_flags[0], 3, 0); // reduce all but the first primary stress ix=0; @@ -1085,22 +1085,22 @@ strcpy(phonemes2,phonemes); } strcpy(word_phonemes,prefix_phonemes); strcat(word_phonemes,phonemes); - SetWordStress(tr, word_phonemes, dictionary_flags[0], -1, 0); + SetWordStress(tr, word_phonemes, &dictionary_flags[0], -1, 0); } else { // stress position affects the whole word, including prefix strcpy(word_phonemes,prefix_phonemes); strcat(word_phonemes,phonemes); - SetWordStress(tr, word_phonemes, dictionary_flags[0], -1, tr->prev_last_stress); + SetWordStress(tr, word_phonemes, &dictionary_flags[0], -1, tr->prev_last_stress); } } else { if(prefix_phonemes[0] == 0) - SetWordStress(tr, phonemes, dictionary_flags[0], -1, tr->prev_last_stress); + SetWordStress(tr, phonemes, &dictionary_flags[0], -1, tr->prev_last_stress); else - SetWordStress(tr, phonemes, dictionary_flags[0], -1, 0); + SetWordStress(tr, phonemes, &dictionary_flags[0], -1, 0); strcpy(word_phonemes,prefix_phonemes); strcat(word_phonemes,phonemes); } @@ -1732,7 +1732,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa -static int EmbeddedCommand(unsigned int &source_index) +static int EmbeddedCommand(unsigned int *source_index) {//=================================================== // An embedded command to change the pitch, volume, etc. // returns number of commands added to embedded_list @@ -1745,27 +1745,27 @@ static int EmbeddedCommand(unsigned int &source_index) char *p; int cmd; - c = source[source_index]; + c = source[*source_index]; if(c == '+') { sign = 0x40; - source_index++; + (*source_index)++; } else if(c == '-') { sign = 0x60; - source_index++; + (*source_index)++; } - if(isdigit(source[source_index])) + if(isdigit(source[*source_index])) { - value = atoi(&source[source_index]); - while(isdigit(source[source_index])) + value = atoi(&source[*source_index]); + while(isdigit(source[*source_index])) source_index++; } - c = source[source_index++]; + c = source[(*source_index)++]; if(embedded_ix >= (N_EMBEDDED_LIST - 2)) return(0); // list is full @@ -2131,7 +2131,7 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t } else { - embedded_count += EmbeddedCommand(source_index); + embedded_count += EmbeddedCommand(&source_index); prev_in2 = prev_in; // replace the embedded command by spaces memset(&source[srcix],' ',source_index-srcix); diff --git a/navit/support/espeak/translate.h b/navit/support/espeak/translate.h index fb0488448..0556bf280 100755 --- a/navit/support/espeak/translate.h +++ b/navit/support/espeak/translate.h @@ -405,7 +405,7 @@ typedef struct { #define NUM_SEP_SPACE 0x1000 // allow space as thousands separator (in addition to langopts.thousands_sep) #define NUM_DEC_IT 0x2000 // (LANG=it) speak post-decimal-point digits as a combined number not as single digits -struct Translator +typedef struct Translator {//============= LANGUAGE_OPTIONS langopts; @@ -469,7 +469,7 @@ struct Translator int prepause_timeout; int end_stressed_vowel; // word ends with stressed vowel int prev_dict_flags; // dictionary flags from previous word -}; // end of class Translator +} Translator; // end of class Translator extern int option_tone2; @@ -513,8 +513,8 @@ extern char skip_marker[N_MARKER_LENGTH]; extern wchar_t option_punctlist[N_PUNCTLIST]; // which punctuation characters to announce extern unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS]; -extern Translator *translator; -extern Translator *translator2; +extern struct Translator *translator; +extern struct Translator *translator2; extern const unsigned short *charsets[N_CHARSETS]; extern char dictionary_name[40]; extern char ctrl_embedded; // to allow an alternative CTRL for embedded commands @@ -524,7 +524,7 @@ extern int dictionary_skipwords; extern int (* uri_callback)(int, const char *, const char *); extern int (* phoneme_callback)(const char *); -extern void SetLengthMods(Translator *tr, int value); +extern void SetLengthMods(struct Translator *tr, int value); void LoadConfig(void); int TransposeAlphabet(char *text, int offset, int min, int max); @@ -545,10 +545,10 @@ int isspace2(unsigned int c); int towlower2(unsigned int c); void GetTranslatedPhonemeString(char *phon_out, int n_phon_out); -Translator *SelectTranslator(const char *name); +struct Translator *SelectTranslator(const char *name); int SetTranslator2(const char *name); -void DeleteTranslator(Translator *tr); -int Lookup(Translator *tr, const char *word, char *ph_out); +void DeleteTranslator(struct Translator *tr); +int Lookup(struct Translator *tr, const char *word, char *ph_out); int TranslateNumber(Translator *tr, char *word1, char *ph_out, unsigned int *flags, int wflags); int TranslateRoman(Translator *tr, char *word, char *ph_out); @@ -573,7 +573,7 @@ void CalcPitches(Translator *tr, int clause_tone); int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy); int Unpronouncable(Translator *tr, char *word); -void SetWordStress(Translator *tr, char *output, unsigned int &dictionary_flags, int tonic, int prev_stress); +void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int prev_stress); int TranslateRules(Translator *tr, char *p, char *phonemes, int size, char *end_phonemes, int end_flags, unsigned int *dict_flags); int TranslateWord(Translator *tr, char *word1, int next_pause, WORD_TAB *wtab); void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *tone, char **voice_change); diff --git a/navit/support/espeak/voices.c b/navit/support/espeak/voices.c index 6b0620d8f..168c4f11d 100755 --- a/navit/support/espeak/voices.c +++ b/navit/support/espeak/voices.c @@ -42,6 +42,8 @@ #include "voice.h" #include "translate.h" +#define int(x) ((int)(x)) +#define double(x) ((double)(x)) MNEM_TAB genders [] = { {"unknown", 0}, @@ -1254,7 +1256,7 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int return(0); // sort the selected voices by their score - qsort(voices,nv,sizeof(espeak_VOICE *),(int (__cdecl *)(const void *,const void *))VoiceScoreSorter); + qsort(voices,nv,sizeof(espeak_VOICE *),VoiceScoreSorter); return(nv); } // end of SetVoiceScores @@ -1680,7 +1682,7 @@ espeak_ERROR SetVoiceByProperties(espeak_VOICE *voice_selector) #pragma GCC visibility push(default) -ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec) +const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec) {//======================================================================== #ifndef PLATFORM_RISCOS int ix; @@ -1705,8 +1707,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec) voices_list[n_voices_list] = NULL; // voices list terminator // sort the voices list - qsort(voices_list,n_voices_list,sizeof(espeak_VOICE *), - (int (__cdecl *)(const void *,const void *))VoiceNameSorter); + qsort(voices_list,n_voices_list,sizeof(espeak_VOICE *),VoiceNameSorter); if(voice_spec) @@ -1734,7 +1735,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec) -ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void) +espeak_VOICE *espeak_GetCurrentVoice(void) {//================================================== return(&voice_selected); } diff --git a/navit/support/espeak/wavegen.c b/navit/support/espeak/wavegen.c index 67235c346..a5467ca1e 100755 --- a/navit/support/espeak/wavegen.c +++ b/navit/support/espeak/wavegen.c @@ -152,7 +152,7 @@ static PaStream *pa_stream=NULL; /* default pitch envelope, a steady fall */ #define ENV_LEN 128 - +#define int(x) (int)(x) /* unsigned char Pitch_env0[ENV_LEN] = { 255,253,251,249,247,245,243,241,239,237,235,233,231,229,227,225, @@ -982,16 +982,16 @@ static void AdvanceParameters() for(ix=0; ix <= wvoice->n_harmonic_peaks; ix++) { peaks[ix].freq1 += peaks[ix].freq_inc; - peaks[ix].freq = int(peaks[ix].freq1); + peaks[ix].freq = (int)(peaks[ix].freq1); peaks[ix].height1 += peaks[ix].height_inc; - if((peaks[ix].height = int(peaks[ix].height1)) < 0) + if((peaks[ix].height = (int)(peaks[ix].height1)) < 0) peaks[ix].height = 0; peaks[ix].left1 += peaks[ix].left_inc; - peaks[ix].left = int(peaks[ix].left1); + peaks[ix].left = (int)(peaks[ix].left1); if(ix < 3) { peaks[ix].right1 += peaks[ix].right_inc; - peaks[ix].right = int(peaks[ix].right1); + peaks[ix].right = (int)(peaks[ix].right1); } else { @@ -1004,10 +1004,10 @@ static void AdvanceParameters() if(ix < 7) { peaks[ix].freq1 += peaks[ix].freq_inc; - peaks[ix].freq = int(peaks[ix].freq1); + peaks[ix].freq = (int)(peaks[ix].freq1); } peaks[ix].height1 += peaks[ix].height_inc; - if((peaks[ix].height = int(peaks[ix].height1)) < 0) + if((peaks[ix].height = (int)(peaks[ix].height1)) < 0) peaks[ix].height = 0; } @@ -1123,7 +1123,7 @@ static int ApplyBreath(void) if((amp = wvoice->breath[ix]) != 0) { amp *= (peaks[ix].height >> 14); - value += int(resonator(&rbreath[ix],noise) * amp); + value += (int)(resonator(&rbreath[ix],noise) * amp); } } #endif @@ -1321,12 +1321,12 @@ int Wavegen() for(h=1; h<=h_switch_sign; h++) { - total += (int(sin_tab[theta >> 5]) * harmspect[h]); + total += ((int)(sin_tab[theta >> 5]) * harmspect[h]); theta += waveph; } while(h<=maxh) { - total -= (int(sin_tab[theta >> 5]) * harmspect[h]); + total -= ((int)(sin_tab[theta >> 5]) * harmspect[h]); theta += waveph; h++; } @@ -1751,13 +1751,13 @@ if(option_log_frames) if(ix < 7) { peaks[ix].freq1 = (fr1->ffreq[ix] * v->freq[ix] + v->freqadd[ix]*256) << 8; - peaks[ix].freq = int(peaks[ix].freq1); + peaks[ix].freq = (int)(peaks[ix].freq1); next = (fr2->ffreq[ix] * v->freq[ix] + v->freqadd[ix]*256) << 8; peaks[ix].freq_inc = ((next - peaks[ix].freq1) * (STEPSIZE/4)) / length4; // lower headroom for fixed point math } peaks[ix].height1 = (fr1->fheight[ix] * v->height[ix]) << 6; - peaks[ix].height = int(peaks[ix].height1); + peaks[ix].height = (int)(peaks[ix].height1); next = (fr2->fheight[ix] * v->height[ix]) << 6; peaks[ix].height_inc = ((next - peaks[ix].height1) * STEPSIZE) / length2; -- cgit v1.2.1