From 810fb2404d0ba028144e12b6cd087b051febdc5d Mon Sep 17 00:00:00 2001 From: jonsd Date: Tue, 31 Jul 2007 09:17:13 +0000 Subject: [PATCH] [1.28.03] Added macro in speech.h for max. length of the espeak-data path. Added language: "bs" Bosnian. Fix to speak_lib.h for Windows dll version. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@69 d46cf337-b52f-0410-862d-fd96e6ae7743 --- dictsource/dict_phonemes | 17 +--- dictsource/en_list | 26 +++--- dictsource/en_rules | 15 +-- dictsource/es_list | 2 + dictsource/hi_rules | 4 +- dictsource/hr_list | 16 ++++ dictsource/hr_rules | 5 + dictsource/pt_rules | 20 +++- phsource/compile_report | 11 ++- phsource/ph_french | 13 +-- phsource/ph_zh_yue | 14 ++- phsource/vwl_zh/aang | Bin 28662 -> 28662 bytes src/compiledata.cpp | 24 ++--- src/compiledict.cpp | 6 +- src/dictionary.cpp | 2 +- src/espeak.cpp | 2 +- src/espeakedit.cpp | 4 +- src/extras.cpp | 22 +++-- src/options.cpp | 14 ++- src/options.h | 4 +- src/readclause.cpp | 131 ++++++++++++++++++++++++++- src/speak.cpp | 33 +++++-- src/speak_lib.cpp | 8 +- src/speak_riscos.cpp | 120 +----------------------- src/speech.h | 5 +- src/synth_mbrola.cpp | 2 +- src/synthdata.cpp | 6 +- src/tr_languages.cpp | 1 + src/translate.cpp | 5 +- src/transldlg.cpp | 2 +- src/voices.cpp | 15 +-- src/vowelchart.cpp | 6 +- src/wave.cpp | 7 +- src/wave.h | 2 + windows/espeakedit/src_copy/speech.h | 19 ++-- windows/windows_cmd/src/speech.h | 7 +- windows/windows_dll/src/speak_lib.h | 76 ++++++++-------- windows/windows_dll/src/speech.h | 7 +- windows/windows_sapi/src/speech.h | 7 +- 39 files changed, 368 insertions(+), 312 deletions(-) diff --git a/dictsource/dict_phonemes b/dictsource/dict_phonemes index 13ee286a..861decbc 100644 --- a/dictsource/dict_phonemes +++ b/dictsource/dict_phonemes @@ -143,8 +143,8 @@ Dictionary hr_dict & @ @- @2 a A a: aI aU E e e: E~ i I i: -l- o o: oU r- u U u: -y +l- O o o: oU r- u U +u: y * b d dZ dZ; f g h j k l l^ m n N n^ @@ -336,19 +336,6 @@ h j k l m n N p r R s t w z -Dictionary sr_dict - -& @ @- @2 a A a: aI -aU E e e: E~ i I i: -l- o o: oU r- u U u: -y - -* b d dZ dZ; f g h -j k l l^ m n N n^ -p r R s S t tS ts -tS; v x z Z - - Dictionary mk_dict & @ @- @2 a A a: E diff --git a/dictsource/en_list b/dictsource/en_list index b29617b5..c5d2f25b 100644 --- a/dictsource/en_list +++ b/dictsource/en_list @@ -835,31 +835,32 @@ famine famIn farewell $2 fasten faas@n fathom faD@m -favorite feIv@-rIt // sp. +favorite feIv@-rIt // sp. favourite feIv@-rIt -favorites feIv@-rIts // sp. +favorites feIv@-rIts // sp. favourites feIv@-rIts feisty faIstI2 feline fi:laIn feminine fEm@nIn fete feIt fetus fi:t@s -fi f,aI // as in "hi-fi" +fi f,aI // as in "hi-fi" fiasco fi:'askoU fiery faI@rI2 finale fIn'A:lI2 finance faInans $only finance $verb +finess fI2nEs // for finessed finesse fI2nEs finite faInaIt fishnet fISnEt fiord fi:O@d -fix fIks // for fixer +fix fIks // for fixer flagellum fla2dZEl@m flexible flEksIb@L flier flaI3 flourish flVrI2S -focus foUk@s // ed,ing +focus foUk@s // ed,ing foothold fUthoUld forage f0rIdZ force fo@s @@ -870,11 +871,11 @@ forestall fo@st'O:l foretell fo@t'El forever $2 forewarn $2 -formid fO@m'Id // formidable +formid fO@m'Id // formidable foyer fOIeI freelance fri:laans frigate frIg@t -fringer frIndZ3 // infringer +fringer frIndZ3 // infringer fringing frIndZIN frontend fr'Vnt,End frontpage fr'Vntp,eIdZ @@ -916,7 +917,7 @@ gourmet gU@meI graduate gradju:@t graduate gradju:eIt $verb graffiti gra2fi:tI2 -gredient gri:di@nt // ingredient +gredient gri:di@nt // ingredient grenade gr@neId grosvenor groUv@n3 groupie gru:pI @@ -1011,7 +1012,7 @@ inference Inf@r@ns influenza Influ:'Enz@ infrastructure $1 ingenuity IndZIn'ju:I2tI2 -inherit I2nhErIt // inherited +inherit I2nhErIt // inherited innard In3d inner In3 inning InIN @@ -1020,7 +1021,7 @@ insert Ins3:t $onlys insert Ins'3:t $verb insightful $2 inspire Insp'aI@ -instal I2nstO:l // instalment +instal I2nstO:l // instalment installation Inst@l'eIS@n instinctive $2 insult $2 @@ -1032,12 +1033,12 @@ intern Int3:n interrogatory $3 inventory Inv@ntrI2 interface $1 -intermin I2nt3:mIn // interminable +intermin I2nt3:mIn // interminable internet Int3nEt interrupt $1 $onlys interrupt $3 $verb interval Int3v@L -interven Int3v'i:n // for intervening +interven Int3v'i:n // for intervening intro $1 iris aIrIs irony aIr@nI2 @@ -2252,7 +2253,6 @@ Pandora $2 Penelope p@nEl@pI2 Phoebe fi:bi: Rachel reItS@L -Reilly raIlI2 Rica ri:ka2 Robert r0b3t Roderick r0drIk diff --git a/dictsource/en_rules b/dictsource/en_rules index 913f5d5b..a7817ba6 100644 --- a/dictsource/en_rules +++ b/dictsource/en_rules @@ -1604,9 +1604,8 @@ .group e e E &) e (_ - e (_ =@ - _C) e (_ i: - _CC) e (_ i: + _C) e (_N i: + _CC) e (_N i: _C) e (Be_ i: _CC) e (Be_ i: _CCC) e (Be_ i: @@ -2109,6 +2108,7 @@ _C) er 3: _h) er (A Er _CC) er 3: + _CC) er (A Er _qu) er 3: c) er (am I2r &) ere (_ 3 @@ -2132,7 +2132,6 @@ c) ere (mon ErI2 h) er (en i@r st) ereo ErI2oU - _st) er (A Er m) er (ge '3: erging '3:dZI2N v) er (ge '3: @@ -2686,7 +2685,8 @@ ied (_$2i d // suffix ie (c aI ie (ce i: - _C) ie (_ aI + ie (_ aI + &) ie (_ I2 _r) ie i: iedly IdlI2 _z) ie i: @@ -2714,7 +2714,7 @@ cl) ie (nt aI@ &) ier (y I2@r ier i@ - ier (_ i@ + &) ier (_S2i @ _h) ie (r aI@ pl) ier (_ aI@ _Cr) ier aI@ @@ -2736,7 +2736,7 @@ ser) ies (_ i:z _ar) ies (_ i:z iesc I2Es - &) ie (st_ I2@ + &) iest (_S3i @st pr) ie (st i: _v) ie (t %i@ ie (ve i: @@ -4245,6 +4245,7 @@ regim rEdZIm re (gist rE _) re (i@P2 r,i: + _) rei (l raI _) rele (g rElI2 rele (nt rI2lE rele (v rElI diff --git a/dictsource/es_list b/dictsource/es_list index 618b3a71..50ee0bc3 100644 --- a/dictsource/es_list +++ b/dictsource/es_list @@ -281,6 +281,8 @@ _a a a a $atend _o o o o $atend +v uve +x Ekis _y ,ig@-*'iEQa y ,ig@-*'iEQa $atend diff --git a/dictsource/hi_rules b/dictsource/hi_rules index 604ca753..e60091c9 100755 --- a/dictsource/hi_rules +++ b/dictsource/hi_rules @@ -93,7 +93,7 @@ .group ू ू u: - ूं u~ + ूं u~ // or O~ ?? ूँ u~ .group ृ @@ -312,7 +312,7 @@ ्) य (_ j@3 .group र - र rV + र r@2 र (B r ?1 र (_ r ्) र (_ r@- diff --git a/dictsource/hr_list b/dictsource/hr_list index e4bd644a..80fa03cc 100644 --- a/dictsource/hr_list +++ b/dictsource/hr_list @@ -38,10 +38,12 @@ _?A slovo // unknown letter % p'osto + plus € 'euRo +?2 € 'ev@-*o @ _'at & _'end ! 'usklItSnIk : dv'ototSk& +?2 : dv'otatSk& # b@-*'oj_ / k@-*'oz_ \\ b'EkslES @@ -52,10 +54,12 @@ _?A slovo // unknown letter µ m'ik@-*o ¶ tSl'an&k ° st'up&n^ +?2 ° st'epen _" n'avodnIk _‚ 'otvoReni||n'avodnIk _„ sp'uSteni||n'avodnIk … t@-*'i||t'otSke +?2 … t@-*'i||t'atSke † k@-*'iZ ‡ dv'ost@-*Uki||k@-*'iZ ‰ p@-*'omil @@ -65,6 +69,7 @@ _’ j'ednost@-*'uki||n'avodnIk _“ 'otvoReni||n'avodnIk _” z'atvoReni||n'avodnIk • k@-*'upna||t'otSk& +?2 • k@-*'upna||t'atSk& _– En||ts'r-t& _— Em||ts'r-t& ™ p@-*'o'izvodZ&tS @@ -93,6 +98,8 @@ _, z'aRez _- ts'r-t'its& _. t'otSk& _; t'otSk&z,a*Ez +?2 _. t'atSk& +?2 _; t'atSk&z,a*Ez _< m'an^i||'od _= j'edn&ko _> v'etSi||'od @@ -145,14 +152,22 @@ _6C S'Est'o _0M1 t'isUtS;& _0MA1 t'isUtS;e _1M1 t'isUtS;U +?2 _0M1 h'il^ad& +?2 _0MA1 h'il^ade +?2 _1M1 h'il^adU _0M2 m'ilijUna _0MA2 m'ilijUna _1M2 m'ilijUn +?2 _0M2 m'ilijOna +?2 _0MA2 m'ilijOna +?2 _1M2 m'ilijOn _0M3 m'iliardI _0MA3 m'iliarde _1M3 m'iliardU _0M4 b'ilijUna _1M4 b'ilijUn +?2 _0M4 b'ilijOna +?2 _1M4 b'ilijOn _dpt _:z'a*Ez_ @@ -450,6 +465,7 @@ tzv $dot // Demonstratives tko $u+ +?2 šta $u+ što $u+ koga $pause čega $pause diff --git a/dictsource/hr_rules b/dictsource/hr_rules index 18767c62..74a538f0 100644 --- a/dictsource/hr_rules +++ b/dictsource/hr_rules @@ -1,6 +1,10 @@ // translation rules for Croatian // This file is UTF-8 encoded +// Conditional rules: +// ?1 Croatian +// ?2 Bosnian (Bosna and Hercegovina) + .group a a a a (j A @@ -136,6 +140,7 @@ $ d'ol&R . totSk& +?2 . tatSk& . (. _: \.) . diff --git a/dictsource/pt_rules b/dictsource/pt_rules index 5cbf3129..1431dd80 100755 --- a/dictsource/pt_rules +++ b/dictsource/pt_rules @@ -210,9 +210,20 @@ eu (s eU e (uCK e - j) e (tA_ E - j) e (tAm_ E - j) e (tAs_ E +?1 d) e (CAA y +?1 d) e (CACAA y +?1 d) e (CACAC y +?1 d) e (CACC y +?1 d) e (CCAA y +?1 d) e (nCAA ,e +?1 d) e (CCACA y +?1 d) e (nCACA ,e +?1 d) e (CCACCA y +?1 d) e (nCACCA ,e + + j) e (tA_ E + j) e (tAm_ E + j) e (tAs_ E ?1 _) es (C@@ S // drop initial "e". ?1 _) e (f i // efectuar, etc. @@ -233,7 +244,7 @@ ?1 _f) e (ch y // fechar ?1 _p) e (rcentag y // percentagem ?1 p) e (ssoa y //pessoal, pessoais, etc. -?1 pr) e (cis y // precisar +?1 pr) e (cis y // precisar ?1 pr) e (f y // preferências, etc. ?1 _r) e (cicl y // recicla, reciclagem, etc... ?1 r) e (cor y // recorrer, recordar @@ -717,3 +728,4 @@ + diff --git a/phsource/compile_report b/phsource/compile_report index 9c44c13e..4d397f5e 100644 --- a/phsource/compile_report +++ b/phsource/compile_report @@ -13,7 +13,7 @@ de 32 123 eo 13 108 fi 40 127 - fr 35 118 + fr 34 118 fr_ca 11 118 hi 50 132 hu 23 112 @@ -36,10 +36,10 @@ no 28 122 is 32 121 vi 41 133 - zhy 32 124 + zhy 33 125 sw 14 105 - 4 b/b base fr hi ro + 3 b/b base hi ro 2 b/b_ base hi 2 b/b@ base hi 2 b/b@2 base hi @@ -456,10 +456,10 @@ 10 vowel/e_mid2 af de fi nl sk ro el sw 2 vowel/@_fnt hr mk 1 vowel/@_hgh no - 19 vowel/i base2 en_n en_rp en_wm cy eo fr hu pl it pt pt_pt ++ + 18 vowel/i base2 en_n en_rp en_wm cy eo fr hu pl it pt pt_pt ++ 1 vowel/i# cy 5 vowel/i_2 de nl la sv - 2 vowel/i_3 af sk + 3 vowel/i_3 af fr sk 4 vowel/i_4 fi hu it is 5 vowel/i_5 en_sc 3 vowel/i#_5 pt_pt ro @@ -602,6 +602,7 @@ 1 vwl_sv/r_sv3 sv 1 vwl_zh/aang zhy 1 vwl_zh/ong zhy + 1 vwl_zh/ung zhy 2 w/w base fr 2 w/_w base fr 1 w/w_ base diff --git a/phsource/ph_french b/phsource/ph_french index d2e3064f..5df4ef5c 100644 --- a/phsource/ph_french +++ b/phsource/ph_french @@ -41,7 +41,7 @@ endphoneme phoneme i vowel starttype (i) endtype (i) length 160 - formants vowel/i + formants vowel/i_3 linkout ; endphoneme @@ -279,16 +279,6 @@ phoneme v endphoneme -phoneme B - vcd blb frc - vowelin f1=2 f2=1000 -300 -200 f3=-100 100 - vowelout f1=2 f2=1000 -500 -300 f3=-100 60 len=50 - lengthmod 6 - formants b/b - switchvoicing f -endphoneme - - phoneme p vls blb stop vowelin f1=0 f2=1000 -50 -100 f3=-200 80 amp=11 @@ -308,3 +298,4 @@ endphoneme + diff --git a/phsource/ph_zh_yue b/phsource/ph_zh_yue index b1af6060..dbd5198b 100644 --- a/phsource/ph_zh_yue +++ b/phsource/ph_zh_yue @@ -1,6 +1,4 @@ -// Cantonese Chinese -//================== - + //==================================================== // Tone Numbers //==================================================== @@ -105,7 +103,7 @@ phoneme aau endphoneme phoneme aang - vowel starttype (a) endtype (u) + vowel starttype (a) endtype (a) length 270 formants vwl_zh/aang endphoneme @@ -187,7 +185,7 @@ phoneme ou endphoneme phoneme ong - vowel starttype (o) endtype (u) + vowel starttype (o) endtype (o) length 220 formants vwl_zh/ong endphoneme @@ -201,6 +199,12 @@ phoneme u before N vowel/uu_bck endphoneme +phoneme ung + vowel starttype (u) endtype (u) + length 200 + formants vwl_zh/ung +endphoneme + phoneme ui vowel starttype (u) endtype (i) length 220 diff --git a/phsource/vwl_zh/aang b/phsource/vwl_zh/aang index c713089457ebda2b2dbec141585b4dc88e088d02..8187258ac936c5611f0344d326897422d5640dea 100755 GIT binary patch delta 1361 zcmbW1TSyd99LE3WGCSjp?X0Eith=t8o0~)uk!6;}mJ|vm8+0)$$THI?RHzW5%R@wE zRNDx4p$q22l3K!)-3%h441BQLOGat*Q0RliW_F=E$K4r&sE1yLZCw&QoCQJBwxDiI0m4wh6gL-(y_sCKVh__cD|SHHZpA)nZy@>=!HJ!c{yo)a zT$|8C_w_JL1V`{ra)qS?XvDqPCY*uqEL|C!O`%c)1@UxU_9h(pEuE~IDOO70F*Tp+ zxHi)rPs*88tdsT|;4brpszgE$Oz#rwQk*@oiDU*7%y#M&26Tra6ty zw6_UDkha~a_?>cqT!xGB?qvvjp(NhDX61lI=~8DiN-8dm?SVHdz6ZQv`$@zKZWs1g zd(f(!wt^R_?*9tT+c}V$qP1u>u29-E_mI2Mla=0_E_#DT^|Zl+jj@sgk&rq28+5m2 zVNiK*Sr|~~kpHQH(V6SQls?`QWkW0J0ZHVckKqtov33G4UYKrRD~42FJbxlV1#+## zjoXr1SmA>I**>@L{=i>@18@k6 z5C|NaPhUVU27yDLDeDk}j$I{F9hWJCGCaRl0J_z2tE*5?0srCUepRmc3xS4J>i_@% delta 1079 zcmYLITS!z<6y0Z^bG_GlXYL)vDH})2q|u^?o@OtmqL_(_K`cf}FzI2DWl&*7Q6SL+ zDm#%q=t1-$87bV#lIigg<%b{k`sq3L5rP#%OcK>c=gi!h{uY0BCv@Wk?+ToYrOFYgV7q)P(T|$(97c4o;v`O9 zSV#E*Um4C1@@wt_`->7%g)9HesFv}xk#@mG$5Vpcf&@$Z2pCNeFw*#pd4irXd1Pt< z8O5g-m)dvS{ftM-wMo0_ZP@LwbCipa<0M*Q?0_W>J7%_HEXC&aUKgKRJjx!*zs*(# zmCHBQibMcGdTYVX6as>Dwm?TfL8t=&yHwY9b c4?VfqVx_T^zFPDjOKJI!{GO72)Hp}|2WA2exBvhE diff --git a/src/compiledata.cpp b/src/compiledata.cpp index 8311dc83..f0d2b969 100755 --- a/src/compiledata.cpp +++ b/src/compiledata.cpp @@ -101,7 +101,7 @@ private: int CPhoneme(); void StartPhonemeTable(const char *name); void EndPhonemeTable(); - void CPhonemeFiles(char *path_source); + void CPhonemeFiles(); int NextItem(int type); void UngetItem(); void Error(const char *msg); @@ -173,7 +173,7 @@ private: }; -char path_source[80]; +char path_source[sizeof(path_home)+20]; Compile *compile; @@ -741,7 +741,7 @@ int Compile::LoadWavefile(FILE *f, const char *fname) int resample_wav = 0; char fname_temp[100]; int scale_factor=0; - char command[200]; + char command[sizeof(path_source)+200]; fseek(f,24,SEEK_SET); sr1 = Read4Bytes(f); @@ -894,7 +894,7 @@ int Compile::LoadDataFile(const char *path, int control) int hash; int type_code=' '; REF_HASH_TAB *p, *p2; - char buf[256]; + char buf[sizeof(path_source)+120]; count_references++; @@ -1630,12 +1630,12 @@ void Compile::StartPhonemeTable(const char *name) -void Compile::CPhonemeFiles(char *path_source) -{//=========================================== +void Compile::CPhonemeFiles() +{//========================== int phcode; int item; FILE *f; - char buf[120]; + char buf[sizeof(path_source)+120]; linenum = 1; n_phcodes = 1; // don't use phoneme code=0, it's used as string terminator @@ -1827,7 +1827,7 @@ void Compile::Report(void) REF_HASH_TAB *p; REF_HASH_TAB **list; FILE *f_report; - char fname[80]; + char fname[sizeof(path_source)+20]; // make a list of all the references and sort it list = (REF_HASH_TAB **)malloc(count_references * sizeof(REF_HASH_TAB *)); @@ -1989,7 +1989,7 @@ wxString CompileAllDictionaries() FILE *log; FILE *f_phused; char dictname[80]; - char fname_log[80]; + char fname_log[sizeof(path_dsource)+20]; char save_voice_name[80]; if(!wxDirExists(path_dictsource)) @@ -2073,7 +2073,7 @@ wxString CompileAllDictionaries() void Compile::CPhonemeTab(const char *source) {//======================================== - char fname[130]; + char fname[sizeof(path_source)+40]; wxString report; wxString report_dict; @@ -2176,7 +2176,7 @@ memset(markers_used,0,sizeof(markers_used)); n_phoneme_tabs = 0; stack_ix = 0; StartPhonemeTable("base"); - CPhonemeFiles(path_source); + CPhonemeFiles(); EndPhonemeTable(); WritePhonemeTable(); @@ -2233,7 +2233,7 @@ void CompileMbrola() char name1[40]; char name2[40]; char mbrola_voice[40]; - char buf[150]; + char buf[sizeof(path_home)+30]; int mbrola_ctrl = 20; // volume in 1/16 ths MBROLA_TAB data[N_PHONEME_TAB]; diff --git a/src/compiledict.cpp b/src/compiledict.cpp index 04b10786..c34e2a35 100755 --- a/src/compiledict.cpp +++ b/src/compiledict.cpp @@ -1301,9 +1301,9 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha FILE *f_out; int offset_rules=0; int value; - char fname_buf[130]; - char fname_temp[130]; - char path[80]; + char fname_buf[sizeof(path_home)+15]; + char fname_temp[sizeof(path_home)+15]; + char path[sizeof(path_home)+40]; // path_dsource+20 error_count = 0; diff --git a/src/dictionary.cpp b/src/dictionary.cpp index d6ede2a2..e44a6cc8 100755 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp @@ -127,7 +127,7 @@ int Translator::LoadDictionary(const char *name, int no_error) int length; FILE *f; unsigned int size; - char fname[130]; + char fname[sizeof(path_home)+20]; strcpy(dictionary_name,name); // currently loaded dictionary name diff --git a/src/espeak.cpp b/src/espeak.cpp index 77f8aff7..5b7f30b1 100644 --- a/src/espeak.cpp +++ b/src/espeak.cpp @@ -22,7 +22,7 @@ #include #include #include -#include "sys/stat.h" +#include #include "speak_lib.h" diff --git a/src/espeakedit.cpp b/src/espeakedit.cpp index bb42ae88..d41e8841 100755 --- a/src/espeakedit.cpp +++ b/src/espeakedit.cpp @@ -427,8 +427,8 @@ void MyFrame::OnTools(wxCommandEvent& event) {//========================================= int err; FILE *log; - char fname_log[80]; - char err_fname[130]; + char fname_log[sizeof(path_dsource)+12]; + char err_fname[sizeof(path_home)+15]; switch(event.GetId()) { diff --git a/src/extras.cpp b/src/extras.cpp index 1d853219..98f694ea 100644 --- a/src/extras.cpp +++ b/src/extras.cpp @@ -21,8 +21,9 @@ #include #include "wx/filename.h" #include "wx/sound.h" +#include "wx/dir.h" -#include "sys/stat.h" +#include #include "speak_lib.h" #include "main.h" @@ -487,7 +488,8 @@ void Lexicon_Ru() int counts[20][20][10]; char phonemes[N_WORD_PHONEMES]; - char buf[100]; + char buf[120]; + char fname[sizeof(path_dsource)+20]; // KOI8-R codes for Russian vowels static char vowels[] = {0xa3,0xc0,0xc1,0xc5,0xc9,0xcf,0xd1,0xd5,0xd9,0xdc,0}; @@ -543,18 +545,18 @@ void Lexicon_Ru() } input_length = GetFileLength(buf); - sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_listx_1"); - if((f_out = fopen(buf,"w")) == NULL) + sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_listx_1"); + if((f_out = fopen(fname,"w")) == NULL) { - wxLogError(_T("Can't write to: ")+wxString(buf,wxConvLocal)); + wxLogError(_T("Can't write to: ")+wxString(fname,wxConvLocal)); fclose(f_in); return; } - sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_log"); - f_log = fopen(buf,"w"); - sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_roots_1"); - f_roots = fopen(buf,"w"); + sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_log"); + f_log = fopen(fname,"w"); + sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_roots_1"); + f_roots = fopen(fname,"w"); LoadVoice("ru",0); @@ -1211,6 +1213,7 @@ result = espeak_SetVoiceByProperties(&voice); return 0; } + char* text1 = "Hello World2. This is the second sentence"; void TestTest(int control) @@ -1227,7 +1230,6 @@ void TestTest(int control) //CharsetToUnicode("ISO-8859-4"); //CharsetToUnicode("ISCII"); -test4(); return; if(control==2) diff --git a/src/options.cpp b/src/options.cpp index e238864e..981ab841 100755 --- a/src/options.cpp +++ b/src/options.cpp @@ -20,7 +20,7 @@ #include "wx/wx.h" #include "wx/fileconf.h" -#include "sys/stat.h" +#include #include "speech.h" #ifdef PLATFORM_WINDOWS @@ -36,10 +36,8 @@ extern void strncpy0(char *to,const char *from, int size); extern int GetNumeric(wxTextCtrl *t); extern void SetNumeric(wxTextCtrl *t, int value); extern int samplerate; -extern char path_home[120]; // .speak directory in user's HOME extern char voice_name[40]; -wxString basedir; wxString path_spectload; wxString path_spectload2; wxString path_pitches; @@ -53,7 +51,7 @@ wxString path_modifiervoice; wxString path_dir1; int option_speed=160; -char path_dsource[120]; +char path_dsource[sizeof(path_home)+20]; BEGIN_EVENT_TABLE(Options, wxDialog) EVT_BUTTON(wxID_SAVE,Options::OnCommand) @@ -110,7 +108,7 @@ void Options::OnCommand(wxCommandEvent& event) void ConfigSetPaths() {//================== - // set paths from wxStrings + // set c_string paths from wxStrings strncpy0(path_source,path_phsource.mb_str(wxConvLocal),sizeof(path_source)-1); strcat(path_source,"/"); @@ -123,6 +121,7 @@ void ConfigInit() {//============== long value; wxString string; + wxString basedir; const char *path_base; #ifdef PLATFORM_WINDOWS @@ -133,7 +132,7 @@ void ConfigInit() { wxString RegVal; pRegKey->QueryValue(_T("Path"),RegVal); - strcpy(buf,RegVal.mb_str(wxConvLocal)); + strncpy0(buf,RegVal.mb_str(wxConvLocal),sizeof(buf)); path_base = buf; } else @@ -156,7 +155,7 @@ void ConfigInit() #endif WavegenInit(value,0); - pConfig->Read(_T("/basedir"),&basedir,wxString(path_base,wxConvLocal)); + basedir = wxString(path_base,wxConvLocal); // this is only used to set defaults for other paths if they are not in the config file pConfig->Read(_T("/spectload"),&path_spectload,basedir+_T("/phsource")); pConfig->Read(_T("/spectload2"),&path_spectload2,basedir+_T("/phsource")); pConfig->Read(_T("/pitchpath"),&path_pitches,basedir+_T("/pitch")); @@ -183,7 +182,6 @@ void ConfigSave(int exit) #ifndef PLATFORM_WINDOWS pConfig->Write(_T("/samplerate"),samplerate); #endif - pConfig->Write(_T("/basedir"),basedir); pConfig->Write(_T("/spectload"),path_spectload); pConfig->Write(_T("/spectload2"),path_spectload2); pConfig->Write(_T("/pitchpath"),path_pitches); diff --git a/src/options.h b/src/options.h index e0b950e6..02a4bd8e 100755 --- a/src/options.h +++ b/src/options.h @@ -40,8 +40,8 @@ extern wxString path_dictsource; extern wxString path_modifiervoice; extern wxString path_dir1; -extern char path_source[80]; -extern char path_dsource[120]; +extern char path_source[sizeof(path_home)+20]; +extern char path_dsource[sizeof(path_home)+20]; extern int option_speed; diff --git a/src/readclause.cpp b/src/readclause.cpp index 5c9cf6f2..db687bdc 100644 --- a/src/readclause.cpp +++ b/src/readclause.cpp @@ -34,6 +34,7 @@ #include "synthesize.h" #include "translate.h" +#include #define N_XML_BUF 256 espeak_VOICE *SelectVoice(espeak_VOICE *voice_select, int *variant); @@ -151,7 +152,131 @@ const int param_defaults[N_SPEECH_PARAM] = { }; -#ifdef PLATFORM_RISCOS +#ifdef NEED_WCHAR_FUNCTIONS + +// additional Latin characters beyond the Latin1 character set +#define MAX_WALPHA 0x233 +// indexed by character - 0x100 +// 0=not alphabetic, 0xff=lower case, other=value to add to upper case to convert to lower case +static unsigned char walpha_tab[MAX_WALPHA-0xff] = { + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 100 + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 110 + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 120 + 0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1, // 130 + 0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, // 140 + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 150 + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 160 + 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, // 170 + 0xff, 210, 1,0xff, 1,0xff, 206, 1,0xff, 205, 205, 1,0xff,0xff, 79, 202, // 180 + 203, 1,0xff, 205, 207,0xff, 211, 209, 1,0xff,0xff,0xff, 211, 213,0xff, 214, // 190 + 1,0xff, 1,0xff, 1,0xff, 218, 1,0xff, 218,0xff,0xff, 1,0xff, 218, 1, // 1a0 + 0xff, 217, 217, 1,0xff, 1,0xff, 219, 1,0xff,0xff,0xff, 1,0xff,0xff,0xff, // 1b0 + 0xff,0xff,0xff,0xff, 2, 1,0xff, 2, 1,0xff, 2, 1,0xff, 1,0xff, 1, // 1c0 + 0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, // 1d0 + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1e0 + 0xff, 2, 1,0xff, 1,0xff,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1f0 + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 200 + 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 210 + 0xff, 0, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 220 + 1,0xff, 1,0xff }; // 230 + +// use ctype.h functions for Latin1 (character < 0x100) +int iswalpha(int c) +{ + if(c < 0x100) + return(isalpha(c)); + if(c > MAX_WALPHA) + return(0); + return(walpha_tab[c-0x100]); +} + +int iswdigit(int c) +{ + if(c < 0x100) + return(isdigit(c)); + return(0); +} + +int iswalnum(int c) +{ + if(iswdigit(c)) + return(1); + return(iswalpha(c)); +} + +int towlower(int c) +{ + int x; + if(c < 0x100) + return(tolower(c)); + if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x100])==0xff)) + return(c); // already lower case + return(c + x); // convert to lower case +} + +int towupper(int c) +{ + // check whether the previous character code is the upper-case equivalent of this character + if(tolower(c-1) == c) + return(c-1); // yes, use it + return(c); // no +} + +int iswupper(int c) +{ + int x; + if(c < 0x100) + return(isupper(c)); + if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x100])==0) || (x == 0xff)) + return(0); + return(1); +} + +int iswlower(int c) +{ + if(c < 0x100) + return(islower(c)); + if((c > MAX_WALPHA) || (walpha_tab[c-0x100] != 0xff)) + return(0); + return(1); +} + +int iswspace(int c) +{ + if(c < 0x100) + return(isspace(c)); + return(0); +} + +int iswpunct(int c) +{ + if(c < 0x100) + return(ispunct(c)); + return(0); +} + +const wchar_t *wcschr(const wchar_t *str, int c) +{ + while(*str != 0) + { + if(*str == c) + return(str); + str++; + } + return(NULL); +} + +const int wcslen(const wchar_t *str) +{ + int ix=0; + + while(*str != 0) + { + ix++; + } + return(ix); +} + float wcstod(const wchar_t *str, wchar_t **tailptr) { int ix; @@ -395,8 +520,8 @@ static int LoadSoundFile(const char *fname, int index) int *ip; int length; char fname_temp[100]; - char fname2[200]; - char command[150]; + char fname2[sizeof(path_home)+13+40]; + char command[sizeof(fname2)+sizeof(fname2)+30]; if(fname == NULL) fname = soundicon_tab[index].filename; diff --git a/src/speak.cpp b/src/speak.cpp index c60ff014..f09399db 100755 --- a/src/speak.cpp +++ b/src/speak.cpp @@ -24,19 +24,23 @@ #include #include #include + +#ifndef PLATFORM_DOS #ifdef PLATFORM_WINDOWS #include #include #else #include #endif +#endif + #ifndef NEED_GETOPT #include #endif #include #include #include -#include "sys/stat.h" +#include #include "speak_lib.h" #include "voice.h" @@ -46,7 +50,8 @@ -char path_home[120]; +char path_home[N_PATH_HOME]; // this is the espeak-data directory + char wavefile[120]; int (* uri_callback)(int, const char *, const char *) = NULL; int (* phoneme_callback)(const char *) = NULL; @@ -225,11 +230,11 @@ static void init_path(void) unsigned long size; unsigned long var_type; char *env; - unsigned char buf[100]; + unsigned char buf[sizeof(path_home)-12]; - if((env = getenv("ESPEAK_DATA_PATH")) != NULL) + if(((env = getenv("ESPEAK_DATA_PATH")) != NULL) && ((strlen(env)+12) < sizeof(path_home))) { - sprintf(path_home,"%s/espeak-data",env); + sprintf(path_home,"%s\\espeak-data",env); if(GetFileLength(path_home) == -2) return; // an espeak-data directory exists } @@ -242,6 +247,9 @@ static void init_path(void) sprintf(path_home,"%s\\espeak-data",buf); #else +#ifdef PLATFORM_DOS + strcpy(path_home,PATH_ESPEAK_DATA); +#else // char *env; // if((env = getenv("ESPEAK_DATA_PATH")) != NULL) // { @@ -256,6 +264,7 @@ static void init_path(void) strcpy(path_home,PATH_ESPEAK_DATA); } #endif +#endif } @@ -553,14 +562,22 @@ int main (int argc, char **argv) if(flag_compile) { -#ifdef PLATFORM_WINDOWS - char path_dsource[120]; +#ifdef PLATFORM_DOS + char path_dsource[sizeof(path_home)+20]; strcpy(path_dsource,path_home); - path_dsource[strlen(path_home)-11] = 0; // renove "espeak-data" from the end + path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end + strcat(path_dsource,"dictsource\\"); + CompileDictionary(path_dsource,dictionary_name,NULL,NULL); +#else +#ifdef PLATFORM_WINDOWS + char path_dsource[sizeof(path_home)+20]; + strcpy(path_dsource,path_home); + path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end strcat(path_dsource,"dictsource\\"); CompileDictionary(path_dsource,dictionary_name,NULL,NULL); #else CompileDictionary(NULL,dictionary_name,NULL,NULL); +#endif #endif exit(0); } diff --git a/src/speak_lib.cpp b/src/speak_lib.cpp index b90a0b90..4b29d9b5 100644 --- a/src/speak_lib.cpp +++ b/src/speak_lib.cpp @@ -30,7 +30,7 @@ #include "speech.h" -#include "sys/stat.h" +#include #ifndef PLATFORM_WINDOWS #include #endif @@ -63,7 +63,7 @@ t_espeak_callback* synth_callback = NULL; int (* uri_callback)(int, const char *, const char *) = NULL; int (* phoneme_callback)(const char *) = NULL; -char path_home[120]; +char path_home[N_PATH_HOME]; // this is the espeak-data directory voice_t voicedata; voice_t *voice = &voicedata; @@ -285,7 +285,7 @@ static void init_path(const char *path) unsigned long size; unsigned long var_type; char *env; - unsigned char buf[100]; + unsigned char buf[sizeof(path_home)-13]; if(path != NULL) { @@ -309,7 +309,7 @@ static void init_path(const char *path) sprintf(path_home,"%s\\espeak-data",buf); #else - char *env; +// char *env; if(path != NULL) { diff --git a/src/speak_riscos.cpp b/src/speak_riscos.cpp index b98bbcf7..df1bbd17 100644 --- a/src/speak_riscos.cpp +++ b/src/speak_riscos.cpp @@ -129,122 +129,6 @@ static const char *help_text = "\t If is omitted, then list all voices.\n"; -// additional Latin characters beyond the Latin1 character set -#define MAX_WALPHA 0x233 -// indexed by character - 0x100 -// 0=not alphabetic, 0xff=lower case, other=value to add to upper case to convert to lower case -static unsigned char walpha_tab[MAX_WALPHA-0xff] = { - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 100 - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 110 - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 120 - 0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1, // 130 - 0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, // 140 - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 150 - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 160 - 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, // 170 - 0xff, 210, 1,0xff, 1,0xff, 206, 1,0xff, 205, 205, 1,0xff,0xff, 79, 202, // 180 - 203, 1,0xff, 205, 207,0xff, 211, 209, 1,0xff,0xff,0xff, 211, 213,0xff, 214, // 190 - 1,0xff, 1,0xff, 1,0xff, 218, 1,0xff, 218,0xff,0xff, 1,0xff, 218, 1, // 1a0 - 0xff, 217, 217, 1,0xff, 1,0xff, 219, 1,0xff,0xff,0xff, 1,0xff,0xff,0xff, // 1b0 - 0xff,0xff,0xff,0xff, 2, 1,0xff, 2, 1,0xff, 2, 1,0xff, 1,0xff, 1, // 1c0 - 0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, // 1d0 - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1e0 - 0xff, 2, 1,0xff, 1,0xff,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1f0 - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 200 - 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 210 - 0xff, 0, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 220 - 1,0xff, 1,0xff }; // 230 - -// use ctype.h functions for Latin1 (character < 0x100) -int iswalpha(int c) -{ - if(c < 0x100) - return(isalpha(c)); - if(c > MAX_WALPHA) - return(0); - return(walpha_tab[c-0x100]); -} - -int iswdigit(int c) -{ - if(c < 0x100) - return(isdigit(c)); - return(0); -} - -int iswalnum(int c) -{ - if(iswdigit(c)) - return(1); - return(iswalpha(c)); -} - -int towlower(int c) -{ - int x; - if(c < 0x100) - return(tolower(c)); - if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x100])==0xff)) - return(c); // already lower case - return(c + x); // convert to lower case -} - -int iswupper(int c) -{ - int x; - if(c < 0x100) - return(isupper(c)); - if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x100])==0) || (x == 0xff)) - return(0); - return(1); -} - -int iswlower(int c) -{ - if(c < 0x100) - return(islower(c)); - if((c > MAX_WALPHA) || (walpha_tab[c-0x100] != 0xff)) - return(0); - return(1); -} - -int iswspace(int c) -{ - if(c < 0x100) - return(isspace(c)); - return(0); -} - -int iswpunct(int c) -{ - if(c < 0x100) - return(ispunct(c)); - return(0); -} - -const wchar_t *wcschr(const wchar_t *str, int c) -{ - while(*str != 0) - { - if(*str == c) - return(str); - str++; - } - return(NULL); -} - -const int wcslen(const wchar_t *str) -{ - int ix=0; - - while(*str != 0) - { - ix++; - } - return(ix); -} - - int GetFileLength(const char *filename) {//==================================== int length=0; @@ -284,7 +168,7 @@ void ReadVoiceNames2(char *directory) _kernel_swi_regs regs; _kernel_oserror *error; char buf[80]; - char directory2[80]; + char directory2[sizeof(path_home)+100]; regs.r[0] = 10; regs.r[1] = (int)directory; @@ -324,7 +208,7 @@ void ReadVoiceNames2(char *directory) void ReadVoiceNames() {//=================== - char directory[80]; + char directory[sizeof(path_home)+10]; for(n_voice_files=0; n_voice_files> 16) == tolower(next_in)) + if((word >> 16) == (unsigned int)tolower(next_in)) { new_c = langopts.replacement_chars[ix]; ignore_next = 1; @@ -1616,10 +1616,9 @@ int Translator::TranslateChar(char *ptr, int prev_in, unsigned int c, unsigned i *insert = c2; new_c &= 0xffff; } -#ifndef PLATFORM_RISCOS + if(upper_case) new_c = towupper(new_c); -#endif return(new_c); } diff --git a/src/transldlg.cpp b/src/transldlg.cpp index c49f901c..7af1ce4e 100755 --- a/src/transldlg.cpp +++ b/src/transldlg.cpp @@ -247,7 +247,7 @@ void TranslDlg::ReadVoice() {//======================== wxString path; wxString filename; - char fname[130]; + char fname[sizeof(path_home)+10]; sprintf(fname,"%s/voices",path_home); path = wxFileSelector(_T("Load voice"),wxString(fname,wxConvLocal),_T(""),_T(""),_T("*"),wxOPEN); diff --git a/src/voices.cpp b/src/voices.cpp index 0f485adb..0084f9dd 100755 --- a/src/voices.cpp +++ b/src/voices.cpp @@ -59,7 +59,7 @@ int formant_rate[9]; // values adjusted for actual sample rate #define DEFAULT_LANGUAGE_PRIORITY 5 -#define N_VOICES_LIST 100 +#define N_VOICES_LIST 150 static int n_voices_list = 0; static espeak_VOICE *voices_list[N_VOICES_LIST]; static int len_path_voices; @@ -226,11 +226,12 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char*lea // Read a Voice file, allocate a VOICE_DATA and set data from the // file's language, gender, name lines - char linebuf[120]; + char linebuf[80]; char vname[80]; char vgender[80]; char vlanguage[80]; char languages[300]; // allow space for several alternate language names and priorities + char fname_buf[sizeof(path_home)+15]; unsigned int len; @@ -249,9 +250,9 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char*lea // check whether the mbrola speech data is present for this voice memcpy(vname,&leafname[3],3); vname[3] = 0; - sprintf(linebuf,"%s/mbrola/%s",path_home,vname); + sprintf(fname_buf,"%s/mbrola/%s",path_home,vname); - if(GetFileLength(linebuf) <= 0) + if(GetFileLength(fname_buf) <= 0) return(0); } #endif @@ -534,7 +535,7 @@ voice_t *LoadVoice(const char *vname, int control) char phonemes_name[40]; char *language_type; char buf[200]; - char path_voices[140]; + char path_voices[sizeof(path_home)+12]; char langname[4]; int stress_amps[8]; @@ -1327,7 +1328,7 @@ void GetVoices(const char *path) FILE *f_voice; espeak_VOICE *voice_data; int ftype; - char fname[140]; + char fname[sizeof(path_home)+100]; #ifdef PLATFORM_RISCOS #else @@ -1500,7 +1501,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec) int ix; static espeak_VOICE *voices[N_VOICES_LIST]; char selected_voice_id[80]; - char path_voices[130]; + char path_voices[sizeof(path_home)+12]; // free previous voice list data if((voice_selected != NULL) && (voice_selected->identifier != NULL)) diff --git a/src/vowelchart.cpp b/src/vowelchart.cpp index 7784ce85..8a22e177 100644 --- a/src/vowelchart.cpp +++ b/src/vowelchart.cpp @@ -35,11 +35,11 @@ #include "phoneme.h" #include "synthesize.h" #include "translate.h" +#include "options.h" /* Read a file of vowel symbols and f1,f2 formants, and produce a vowel diagram */ extern wxString path_phsource; -extern char path_source[]; extern char voice_name[]; extern char *spects_data; @@ -458,8 +458,8 @@ void MakeVowelLists(void) SPECT_SEQ *seq; frame_t *frame; int match_level; - char dirname[100]; - char fname[120]; + char dirname[sizeof(path_source)+20]; + char fname[sizeof(dirname)+40]; progress = new wxProgressDialog(_T("Vowel charts"),_T(""),n_phoneme_tables); diff --git a/src/wave.cpp b/src/wave.cpp index f1de836e..ec72692d 100755 --- a/src/wave.cpp +++ b/src/wave.cpp @@ -100,11 +100,11 @@ static void init_buffer() SHOW("init_buffer > myRead=0x%x, myWrite=0x%x, BUFFER_LENGTH=0x%x, myReadPosition = myWritePosition = 0\n", (int)myRead, (int)myWrite, BUFFER_LENGTH); } -static int get_used_mem() +static unsigned int get_used_mem() { char* aRead = myRead; char* aWrite = myWrite; - int used = 0; + unsigned int used = 0; assert ((aRead >= myBuffer) && (aRead <= myBuffer + BUFFER_LENGTH) @@ -129,12 +129,13 @@ static int get_used_mem() static void start_stream() { + PaError err; SHOW_TIME("start_stream"); my_stream_could_start=0; mInCallbackFinishedState = false; - PaError err = Pa_StartStream(pa_stream); + err = Pa_StartStream(pa_stream); SHOW("start_stream > Pa_StartStream=%d (%s)\n", err, Pa_GetErrorText(err)); #if USE_PORTAUDIO == 19 diff --git a/src/wave.h b/src/wave.h index 55af637b..cf0009d4 100644 --- a/src/wave.h +++ b/src/wave.h @@ -1,7 +1,9 @@ #ifndef WAVE_H #define WAVE_H +#ifndef PLATFORM_DOS #include "stdint.h" +#endif extern int option_device_number; diff --git a/windows/espeakedit/src_copy/speech.h b/windows/espeakedit/src_copy/speech.h index ae80a966..667b3f79 100755 --- a/windows/espeakedit/src_copy/speech.h +++ b/windows/espeakedit/src_copy/speech.h @@ -26,17 +26,17 @@ // comment this out when compiling the "speak" process //#define SPECT_EDITOR - + #include -#define PLATFORM_WINDOWS -#define __WIN32__ -#define mkdir(p1,p2) mkdir(p1) +#define PLATFORM_WINDOWS +#define __WIN32__ +#define mkdir(p1,p2) mkdir(p1) #define PATHSEP '\\' #define USE_PORTAUDIO //#define USE_NANOSLEEP #define __cdecl -#define ESPEAK_API +#define ESPEAK_API #define PATH_ESPEAK_DATA "C:\\Program files\\espeak\\espeak-data" typedef unsigned short USHORT; @@ -72,8 +72,9 @@ int GetFileLength(const char *filename); char *Alloc(int size); void Free(void *ptr); +#define N_PATH_HOME 120 +extern char path_home[N_PATH_HOME]; // this is the espeak-data directory + +extern const char *version_string; +extern const int version_phdata; extern void strncpy0(char *to,const char *from, int size); -extern char path_home[]; - -extern const int version_phdata; -extern const char *version_string; diff --git a/windows/windows_cmd/src/speech.h b/windows/windows_cmd/src/speech.h index ed893f65..2373977a 100755 --- a/windows/windows_cmd/src/speech.h +++ b/windows/windows_cmd/src/speech.h @@ -75,9 +75,10 @@ char *Alloc(int size); void Free(void *ptr); -extern void strncpy0(char *to,const char *from, int size); -extern char path_home[]; +#define N_PATH_HOME 120 +extern char path_home[N_PATH_HOME]; // this is the espeak-data directory -extern const int version_phdata; extern const char *version_string; +extern const int version_phdata; +extern void strncpy0(char *to,const char *from, int size); diff --git a/windows/windows_dll/src/speak_lib.h b/windows/windows_dll/src/speak_lib.h index 7392b23e..8e299bf9 100644 --- a/windows/windows_dll/src/speak_lib.h +++ b/windows/windows_dll/src/speak_lib.h @@ -1,12 +1,12 @@ #ifndef SPEAK_LIB_H #define SPEAK_LIB_H /*************************************************************************** - * Copyright (C) 2006 by Jonathan Duddington * - * jonsd@users.sourceforge.net * + * Copyright (C) 2005 to 2007 by Jonathan Duddington * + * email: jonsd@users.sourceforge.net * * * * 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 2 of the License, or * + * 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, * @@ -15,9 +15,8 @@ * 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * along with this program; if not, see: * + * . * ***************************************************************************/ @@ -29,14 +28,12 @@ #include - -#define ESPEAK_LIB_REVISION 2 +#define ESPEAK_API_REVISION 2 /* Revision 2 Added parameter "options" to eSpeakInitialize() */ - /********************/ /* Initialization */ /********************/ @@ -49,7 +46,8 @@ typedef enum { espeakEVENT_MARK, // Mark espeakEVENT_PLAY, // Audio element espeakEVENT_END, // End of sentence - espeakEVENT_MSG_TERMINATED // End of message + espeakEVENT_MSG_TERMINATED, // End of message + espeakEVENT_PHONEME // Phoneme, if enabled in espeak_Initialize() } espeak_EVENT_TYPE; @@ -63,7 +61,7 @@ typedef struct { int sample; // sample id (internal use) void* user_data; // pointer supplied by the calling program union { - int number; // used for WORD and SENTENCE events + int number; // used for WORD and SENTENCE events. For PHONEME events this is the phoneme mnemonic. const char *name; // used for MARK and PLAY events. UTF8 string } id; } espeak_EVENT; @@ -146,7 +144,7 @@ typedef enum { #ifdef __cplusplus extern "C" #endif -ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path); +int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options); /* Must be called before any synthesis functions are called. output: the audio data can either be played by eSpeak or passed back by the SynthCallback function. @@ -154,7 +152,10 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, cons path: The directory which contains the espeak-data directory, or NULL for the default location. - Returns: sample rate in Hz + options: bit 0: 1=allow espeakEVENT_PHONEME events. + + + Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR). */ typedef int (t_espeak_callback)(short*, int, espeak_EVENT*); @@ -162,7 +163,7 @@ typedef int (t_espeak_callback)(short*, int, espeak_EVENT*); #ifdef __cplusplus extern "C" #endif -ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback); +void espeak_SetSynthCallback(t_espeak_callback* SynthCallback); /* Must be called before any synthesis functions are called. This specifies a function in the calling program which is called when a buffer of speech sound data has been produced. @@ -180,7 +181,8 @@ int SynthCallback(short *wav, int numsamples, espeak_EVENT *events); sometimes be zero (which does NOT indicate end of synthesis). events: an array of espeak_EVENT items which indicate word and sentence events, and - also the occurance if and