diff --git a/dictsource/dict_log b/dictsource/dict_log index 041f583c..646b9bcf 100644 --- a/dictsource/dict_log +++ b/dictsource/dict_log @@ -1,6 +1,6 @@ -Using phonemetable: 'hu' -Compiling: '/home/jsd1/speechdata/dictsource/hu_list' - 2083 entries -Compiling: '/home/jsd1/speechdata/dictsource/hu_rules' - 1643 rules, 45 groups (0) +Using phonemetable: 'fi' +Compiling: '/home/jsd1/speechdata/dictsource/fi_list' + 316 entries +Compiling: '/home/jsd1/speechdata/dictsource/fi_rules' + 129 rules, 29 groups (0) diff --git a/dictsource/dict_phonemes b/dictsource/dict_phonemes index a32b71ac..838dfd79 100644 --- a/dictsource/dict_phonemes +++ b/dictsource/dict_phonemes @@ -66,7 +66,7 @@ R3 s S t T tS v w x z Z -Dictionary hu_dict 2011-10-07 +Dictionary hu_dict 2011-10-13 a A a: E e: i i: o o: u u: Y y y: Y: @@ -140,7 +140,7 @@ N n^ p Q R R2 s S t T tS v v# w x z -Dictionary fi_dict 2009-05-01 +Dictionary fi_dict 2011-10-14 & &i &y a a2 ai au e ei eu ey i I ie iu iy @@ -148,8 +148,8 @@ o oi ou u ui uo Y y Yi yi Yy yY : b d f g h j k -l m n N p r s S -s2 t v w Z +l m n N p r R s +S s2 t v w Z Dictionary fr_dict 2011-08-14 @@ -327,7 +327,7 @@ k l m n p R s S t tS v w x -Dictionary nl_dict 2011-09-12 +Dictionary nl_dict 2011-10-13 8 @ @- a A a: A~ e E e# E2 e: EI eU i I diff --git a/dictsource/fi_list b/dictsource/fi_list index 7a55c65e..9806f2bc 100644 --- a/dictsource/fi_list +++ b/dictsource/fi_list @@ -59,23 +59,23 @@ _: kaksoispiste % prosent:i _( alkusulku _) lop:usulku -_[ alkuhaka2 -_] lop:uhaka2 +_[ alkuhaka +_] lop:uhaka _{ alkua:lto _} lop:ua:lto _< p'ienempIk'uin _> s'u:rempIk'uin -_- vi:va2 -__ ala2vi:va2 +_- vi:va +__ alavi:va + plus $max3 * asteriski $max3 = 'yht&k'uin $max3 % prosent:I $max3 -/ kaut:a2 +/ kaut:a \ keno € euro -£ punta2 -¤ valu:t:a2 +£ punta +¤ valu:t:a & _et @ _&t ~ tilde @@ -98,7 +98,7 @@ _5 v'i:si _6 k'u:si _7 s'eitsem&n _8 k'ahdeksan -_9 'yhdeks&m +_9 'yhdeks&n _10 k'ymmenen _11 'yksitoista _12 k'aksitoista @@ -114,16 +114,16 @@ _3X k'olmekymment& _4X n'elj&kymment& _5X v'i:sikymment& _6X k'u:sikymment& -_7X s'eitsem&nk,ymment& -_8X k'ahdeksank,ymment& -_9X 'yhdeks&mk,ymment& +_7X s'eitsem&Nk,ymment& +_8X k'ahdeksaNk,ymment& +_9X 'yhdeks&Nk,ymment& _0C s'ata:_ _1C s'ata _0M1 t'uhat:a _1M1 t'uhat // no '1' before thousand _0M2 m'iljo:na: _1M2 m'iljo:na -_0M3 m'iljardi +_0M3 m'iljardia _1M3 m'iljardi _0M4 b'iljo:na: _1M4 b'iljo:na @@ -143,7 +143,7 @@ te $u he $u ne $u -itse $u $double // reflexive pronoun +itse $u+ $double // reflexive pronoun tämä $u+ // this tämän $u+ @@ -222,7 +222,7 @@ ja $u $pause // and entä $u $pause // and tai $u $pause // or vai $u $pause -mutta $u $pause // but +mutta $u+ $pause // but // negative @@ -237,7 +237,7 @@ eivät $u // auxillary verbs -olla $u // to be +olla $u $double // to be olen $u olet $u on $u @@ -267,12 +267,12 @@ lienee $u lienemme $u lienette $u lienevät $u -liene $u +liene $u $double lienneet $u // some common adjectives and adverbs -vähän $u // some +vähän $u+ // some // words that cause doubling kiinni $double @@ -284,6 +284,7 @@ tuore $double aihe $double aste $double kone $double +ihme $double // miracle. Common in spoken Finnish of Helsinki. laite $double lause $double luode $double @@ -294,6 +295,7 @@ purje $double tunne $double vene $double virhe $double +virke $double // sentence (full one, unlike lause) aja $double auta $double @@ -304,33 +306,85 @@ pure $double syö $double tule $double +// Verb base forms and passive present connegatives +ajeta $double // passive connegative +auteta $double // connegative +mennä $double // base form and connegative +oteta $double // connegative +pueta $double // connegative +pukea $double // base form +purra $double // both +syödä $double // both +tulla $double // both + +// No doubling, ends in -sti +kasti kastI // Adverbs that end in –sti cause doubling of the following consonant. These are some other words that end in –sti and therefore they don’t double the following consonant. +kesti kestI +kosti kostI +kyösti kyYstI +pelasti pelastI +pianisti pianistI +posti postI +puristi puRIstI +pysti pystI +päästi p&:stI +rasti RastI +risti RistI +ryösti RyYstI +varasti vaRastI +viulisti viulIstI + +// No doubling, ends in –lle +galle galle +hille hille +nalle nalle +kalle kalle +pelle pelle +polle polle +promille pRomIlle +sirkuspelle siRkuspelle +ville ville +wille ville + +// No doubling, ends in –nne +Anne anne $capital +hanne hanne +janne janne +manne manne +marianne maRIanne +susanne susanne + +// No doubling, ends in –tse +konfutse konfutse +kungfutse kuNfutse + + + // Pronunciation exceptions -ok oo_,ko: -// ok _^_EN // Translates to english o'kay. -okay okei - -// Jogurtti (also: jugurtti or jukurtti) -yoghurt jogurtti -yogurt jogurtti +ok 'o:_,ko: +okay okei +yoghurt jogurt:i +yogurt jogurt:i // Abbreviations -abc 'a:,be:,se: -os o:&s: $dot -ad a:de: $dot // anno Domini, Herran vuonna -ca 'se:a: $dot // circa -em e:,&m $dot -ekr 'e:,ko:,&r $dot // ennen Kristuksen syntymää -etc et_setera $dot // et cetera, ym., jne. -ym ynn&_mu:ta $dot // ynnä muuta (etc) -eg esimerkiksi $dot // exempli gratia, esimerkiksi -jne 'ji,&n,e: $dot // ja niin edelleen -(à la) 'ala $dot // jonka mukaan -ky ko:y: $dot // kommandiittiyhtiö -oy o:y: // osakeyhtiö -nro numero $dot +abc $abbrev +adhd $abbrev +os $abbrev $dot +ad $abbrev $dot // anno Domini, Herran vuonna +ca $abbrev $dot // circa +em $abbrev $dot +ekr $abbrev $dot // ennen Kristuksen syntymää +etc et_setera $dot // et cetera, ym., jne. +ym ynn&_mu:ta $dot // ynnä muuta (etc) +eg esimerkiksi $dot // exempli gratia, esimerkiksi +jne $abbrev $dot // ja niin edelleen +(à la) 'ala $dot // jonka mukaan +ky $abbrev $dot // kommandiittiyhtiö +oy $abbrev // osakeyhtiö +nro numero $dot diff --git a/dictsource/fi_rules b/dictsource/fi_rules index f0cb68ff..c064e3fd 100644 --- a/dictsource/fi_rules +++ b/dictsource/fi_rules @@ -2,11 +2,16 @@ // This file is UTF-8 encoded +// NOTE: aii, auu, eii etc. are pronounced [a|i:], [a|u:] and [e|i], +// but aaii, aauu and eeii must be pronounced [a:i:], [a:u:] and [e:i:]. + .group a a a aa a: ai ai + aii a|i: // naiivi au au + auu a|u: &) a (lla_ %a @@ -17,7 +22,9 @@ ä & ää &: äi &i + äii &|i: äy &y + äyy &|y: &) ä (lla_ %& @@ -31,6 +38,7 @@ c k c (i s c (e s // Pronounce c as s. Mostly foreign words such as celcius, center, cervantes, cezanne. + c (y s cc k: // Utter cc as k. This includes rebecca, accord, puccini etc. K) ch (r k @@ -47,12 +55,16 @@ e e ee e: ei ei + eii e|i: // fenoliftaleiini eu eu + euu e|u: ey ey + eyy e|y: &) e(lla_ %e &) e(llä_ %e + .group f f f @@ -70,8 +82,11 @@ i i ii i: iu iu + iuu i|u: ie ie + iee i|e: // dieetti iy iy + iyy i|y: // iä ii& // Improve the i in iä words. Eg. ryhmiä (ryhmä), äitiä. // ia iia // Improve the i in ia words. Eg. mattia, lattia. @@ -103,7 +118,7 @@ .group n n n ng N: - ng (_ N + ng (K N // ng is [N] also when followed by a consonant n (p m n (_p m n (k N @@ -117,9 +132,12 @@ o o oo o: oi oi + oii o|i: // heroiini ou ou + ouu o|u: - symb) o (l oo // double the o in symboli. Include inflections and compound words. + symb) o (l o: // double the o in symboli. Include inflections and compound words. + symb) o (loi o // symboloida with short o @@ -127,7 +145,9 @@ ö Y öö Y: öi Yi + öii Y|i: öy Yy + öyy Y|y: @@ -140,7 +160,7 @@ kam) p (anj p: // double the p in kampanja. Include inflections and compound words. - sam) p (oo p: // double the p in sampoo. Include inflections and compound words. +// sam) p (oo p: // double the p in sampoo. Include inflections and compound words. ”Sampoon” is an inflected form of the word ”sampo” and has a short p. It is not wrong to pronounce sampoo as [s'ampo:] either. Don’t double the p. sham) p (o p: // double the p in shampo. Include inflections and compound words. @@ -157,14 +177,19 @@ s s ss ss2 // [s2] is a continuation for [s] K) sh S + @) sh (an_ sh + @) sh (än_ sh // preesens+hän and similar ones with sh as separate sounds + + K) sch S // Schmitt - @) sti (_ sti_X1 // double the initial consonant of the next word + A) sti (_ sti_X1 // double the initial consonant of the next word only when the –sti ending is preceded by a vowel (e.g. ”teksti” does not double) .group t t t tt t: + tz ts // German names. Instead of former [tts] @) tse (_ tse_X1 // double the initial consonant of the next word @@ -173,7 +198,11 @@ u u uu u: ui wi + _) ui ui + _j) ui ui // [ui] sounds better than [wi] when stressed. Especially at the beginning of the word sounds bad if pronounced [jwi] + uii u|i: uo uo + uoo u|o: .group v @@ -193,24 +222,32 @@ y y yy y: yi yi + yii y|i: yö yY + yöö y|Y: + .group z z ts - zz t:s + zz ts // pizza K) zh Z - pi) zza tsa // Pronounce pizza as pitsa. Include inflections and compound words. .group å o åå o: + ü y + üü y: š S ž Z - $ dollarin + $ dollarin __) - (_D mi:nus A_) - (_D _ C_) - (_D _ + + + + diff --git a/dictsource/hu_list b/dictsource/hu_list index b5c292b5..b1e507fe 100644 --- a/dictsource/hu_list +++ b/dictsource/hu_list @@ -385,7 +385,7 @@ nyári $alt őszi $alt téli $alt végén $alt -elején $alt +elején $alt $unstressend folyamán $alt úton $alt @@ -2197,7 +2197,6 @@ eljárni $unstressend használjuk $unstressend tennivalónk $unstressend létezik $unstressend -kérdés $unstressend blokkok $unstressend túlléptünk $unstressend érdekesség $unstressend @@ -2299,7 +2298,215 @@ kérdésekre $unstressend vonatkoznak $unstressend döntenek $unstressend játszana $unstressend - +kérdőíveket $unstressend +kitalálta $unstressend +vágynak $unstressend +dolgozzanak $unstressend +utazott $unstressend +fejlesztésére $unstressend +koncentrált $unstressend +vékony $unstressend +viselkedett $unstressend +állásban $unstressend +akarta $unstressend +dolgozzon $unstressend +győzködni $unstressend +piszkálni $unstressend +dörömbölt $unstressend +dolgoztak $unstressend +indultak $unstressend +tervről $unstressend +elemzőkben $unstressend +kutatásokban $unstressend +vezesse $unstressend +akarnak $unstressend +részletet $unstressend +kirakata $unstressend +tisztelői $unstressend +rávenni $unstressend +pulóvert $unstressend +magyarországon $unstressend +megalkotója $unstressend +értesültek $unstressend +lakosokat $unstressend +javadalmazást $unstressend +előfordult $unstressend +ívet $unstressend +borítékot $unstressend +példa $unstressend +kitöltés $unstressend +hiányolta $unstressend +érdeklődött $unstressend +költöztek $unstressend +bemutatásával $unstressend +elmondta $unstressend +kódot $unstressend +íveket $unstressend +gyanakszik $unstressend +tudomásuk $unstressend +jelentkeztek $unstressend +utasításba $unstressend +lakásba $unstressend +emlős $unstressend +borítják $unstressend +félnek $unstressend +megoldásnak $unstressend +olcsók $unstressend +termelnek $unstressend +fejlődik $unstressend +elérni $unstressend +lekötött $unstressend +számíthatunk $unstressend +leginkább $unstressend +hajléktalanok $unstressend +vezetése $unstressend +hatályba $unstressend +órát $unstressend +irodába $unstressend +lenni $unstressend +gondolják $unstressend +héten $unstressend +rendőrnek $unstressend +kérdezték $unstressend +szavazott $unstressend +teret $unstressend +formáját $unstressend +büntetni $unstressend +kérdezte $unstressend +sodort $unstressend +szigorítást $unstressend +akció $unstressend +irodán $unstressend +kerület $unstressend +utcába $unstressend +rákérdezett $unstressend +sújtják $unstressend +szemetesekből $unstressend +nyomán $unstressend +kidolgozta $unstressend +változatait $unstressend +gondok $unstressend +kinézettel $unstressend +megtenni $unstressend +zavar $unstressend +babrálni $unstressend +művel $unstressend +kérdésem $unstressend +történt $unstressend +csinálni $unstressend +használt $unstressend +címek $unstressend +tárolók $unstressend +pártját $unstressend +helye $unstressend +törvényjavaslatot $unstressend +nyugállományba $unstressend +egyetem $unstressend +felszólalások $unstressend +módosításáról $unstressend +adna $unstressend +számolnak $unstressend +várnak $unstressend +közlekedésből $unstressend +oktatásból $unstressend +tandíjat $unstressend +önmagával $unstressend +forrásból $unstressend +bűnesetről $unstressend +nénit $unstressend +hátán $unstressend +idős $unstressend +példáktól $unstressend +közbiztonságért $unstressend +vetette $unstressend +koncentrálnak $unstressend +idézett $unstressend +bajokról $unstressend +teremt $unstressend +tartalmaz $unstressend +képviselőket $unstressend +eléggé $unstressend +költségvetése $unstressend +szerződést $unstressend +tétele $unstressend +ígérte $unstressend +ellen $unstressend +elől $unstressend +helyzetért $unstressend +hangsúlyozta $unstressend +vételét $unstressendtárgyaljanak $unstressend +tárgyaljanak $unstressend +védelmét $unstressend +elegendőnek $unstressend +házszabálytól $unstressend +kiterjesztését $unstressend +segít $unstressend +frakciójára $unstressend +országot $unstressend +összerakott $unstressend +döntéseket $unstressend +szül $unstressend +döntést $unstressend +eltérést $unstressend +pénzintézetektől $unstressend +magának $unstressend +probléma $unstressend +hagyta $unstressend +szülessenek $unstressend +okoztak $unstressend +képessége $unstressend +kicsit $unstressend +segítené $unstressend +támogatta $unstressend +javaslatokat $unstressend +intézményeknél $unstressend +intézmények $unstressend +támogatása $unstressend +szándék $unstressend +kérdezett $unstressend +adó $unstressend +látják $unstressend +adót $unstressend +miatta $unstressend +európából $unstressend +válaszolta $unstressend +szektorral $unstressend +feltételeit $unstressend +biztosítják $unstressend +kivételével $unstressend +állattartásra $unstressend +állat $unstressend +tevékenység $unstressend +elérésére $unstressend +irányul $unstressend +előállítását $unstressend +szervezet $unstressend +tulajdonosa $unstressend +jelleggel $unstressend +jogszabályokban $unstressend +hozzájárulásokban $unstressend +tartása $unstressend +létesítmény $unstressend +közintézmény $unstressend +üzem $unstressend +célú $unstressend +kérelmére $unstressend +hozzájárulásával $unstressend +helységekben $unstressend +kijutni $unstressend +ingatlant $unstressend +üzletekbe $unstressend +intézményekbe $unstressend +épületekbe $unstressend +épületébe $unstressend +terjedő $unstressend +hitelét $unstressend +forintot $unstressend +hitelt $unstressend +gazdaság $unstressend +gazdaságnak $unstressend +esedékes $unstressend +fedezet $unstressend // word pairs diff --git a/dictsource/hu_rules b/dictsource/hu_rules index e1e74d1f..571d8ee2 100644 --- a/dictsource/hu_rules +++ b/dictsource/hu_rules @@ -148,7 +148,7 @@ hierar) ch (i h stri) ch (el h: ar) ch (ív h ar) ch (ivál h - ar) ch (itektúr h + ar) ch (itektú h ma) ch (iná h oligar) ch h legpe) ch (es h: @@ -306,6 +306,7 @@ standar) d (jegy d máso) d (szaká d //For example másodszakács, másodszakáccsá words need spokening single d phoneme before s phoneme _ná) d (söv d //for example nádsövénnyé word dt (sz t: +miliár) d (szor d .group dz fogó) dz (kod ts @@ -1285,6 +1286,8 @@ házasi) ts (a tS: _pázsi) t (sz t fejeze) t (sor t _o) ttj (ár tj + _spor) t (cél t + pó) t (selejt t .group tj C) tj c diff --git a/dictsource/nl_list b/dictsource/nl_list index a7df54f3..81b73234 100644 --- a/dictsource/nl_list +++ b/dictsource/nl_list @@ -363,21 +363,24 @@ websites _^_EN weekend _^_EN -// verbs where -ent is not a stressed ending -bakent $alt -effent $alt -jegent $alt -kerstent $alt -ketent $alt -loochent $alt -oefent $alt -opent $alt -regent $alt -rekent $alt -stevent $alt -tekent $alt -wapent $alt -zegent $alt +// verbs where -ent, -ene, -enen is not a stressed ending +baken $alt +effen $alt +jegen $alt +kersten $alt +keten $alt +loochen $alt +oefen $alt +open $alt +regen $alt +reken $alt +schepen $alt +steven $alt +teken $alt +wapen $alt +zegen $alt +trokken $alt +zeten $alt // words where -er is not a stressed verb ending diff --git a/dictsource/nl_rules b/dictsource/nl_rules index ce3dfefe..7b3630aa 100644 --- a/dictsource/nl_rules +++ b/dictsource/nl_rules @@ -151,6 +151,7 @@ ds (_N ts d (st t // _) de (CC@P2 d@ // Used a lot in family names + _) de (geen d@ // degene, degenen _) de (zelf d@ @@ -213,13 +214,16 @@ el) en (_+S2qd @n er) en (_+S2qd @n + &) en (e_$p_altS3 =@n@ + &) en (en_$p_altS4 =@n@n + &) en (t_$p_altS3 =@nt + &) ens (_S3q @ns ll) en (_S3 @n &) end (_ @nd &) ende (_S1 @ &) enden (_S2 @n eden e:d@n - &) ent (_$w_alt =@nt @) ent (_ 'Ent @) ent (e_ 'Ent @) ent (en_ 'Ent diff --git a/phsource/compile_report b/phsource/compile_report index 241a03ec..8257acd1 100644 --- a/phsource/compile_report +++ b/phsource/compile_report @@ -16,7 +16,7 @@ consonants 10 116 eo 13 114 jbo 2 114 nci 3 123 - fi 40 133 + fi 41 133 et 47 139 fr 59 140 fr-ca 11 140 @@ -394,7 +394,7 @@ l/l_ [l] base [l/] fr l/l_@ [l/3] base [l/] fr -l/l@ [h–] base +l/l@ [hæx] base [l#] base [l] fr [l/2] fr @@ -428,7 +428,7 @@ l/L2_oL [l/2] base l/L2_uL [l/2] base l/l_3 [l/] de l/l_4 [ll] sq -l/la [h–] base +l/la [hæx] base [l#] base [l] fr [l/2] fr @@ -436,7 +436,7 @@ l/la [h [K] tn l/l_a [l/3] base [l/] fr -l/le [h–] base +l/le [hæx] base [l#] base [l] fr [l/2] fr @@ -448,7 +448,7 @@ l/L_eL_af [&] af [&:] af l/l_front [L] sq l/l_front_ [l/4] sq -l/li [h–] base +l/li [hæx] base [l#] base [l] fr [l/2] fr @@ -462,7 +462,7 @@ ll/ll [L] bg ll/_ll [L] bg l/l_long [l] base [l] fr -l/lo [h–] base +l/lo [hæx] base [l#] base [l/2] fr [K] nso @@ -472,7 +472,7 @@ l/l_o [l/3] base l^/l_rfx [l.] base [l] ru [l^] ru -l/lu [h–] base +l/lu [hæx] base [l#] base [l] fr [l/2] fr diff --git a/phsource/ph_finnish b/phsource/ph_finnish index e5840197..75b8b79b 100644 --- a/phsource/ph_finnish +++ b/phsource/ph_finnish @@ -237,6 +237,11 @@ endphoneme +phoneme r + import_phoneme base/R +endphoneme + + phoneme R2 // this is [R2], but shorter liquid trill diff --git a/phsource/vnasal/m- b/phsource/vnasal/m- deleted file mode 100644 index 91385773..00000000 Binary files a/phsource/vnasal/m- and /dev/null differ diff --git a/phsource/vnasal/n- b/phsource/vnasal/n- deleted file mode 100644 index c7d5e7e8..00000000 Binary files a/phsource/vnasal/n- and /dev/null differ diff --git a/phsource/vnasal/nn- b/phsource/vnasal/nn- deleted file mode 100644 index 12b0b08c..00000000 Binary files a/phsource/vnasal/nn- and /dev/null differ diff --git a/src/readclause.cpp b/src/readclause.cpp index 80b61a09..afee0027 100644 --- a/src/readclause.cpp +++ b/src/readclause.cpp @@ -1432,8 +1432,8 @@ void SetVoiceStack(espeak_VOICE *v, const char *variant_name) sp->voice_age = v->age; sp->voice_gender = v->gender; - if(memcmp(variant_name, "!v/", 3) == 0) - variant_name += 3;// strip variant directory name + if(memcmp(variant_name, "!v", 2) == 0) + variant_name += 3;// strip variant directory name, !v plus PATHSEP strncpy0(base_voice_variant_name, variant_name, sizeof(base_voice_variant_name)); memcpy(&base_voice, ¤t_voice_selected, sizeof(base_voice)); } diff --git a/src/speak_riscos.cpp b/src/speak_riscos.cpp deleted file mode 100644 index 78ed6eb1..00000000 --- a/src/speak_riscos.cpp +++ /dev/null @@ -1,1318 +0,0 @@ - -/*************************************************************************** - * 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 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write see: * - * . * - ***************************************************************************/ - -#define USE_MODULE - -#include -#include -#include -#include -#include -#include "kernel.h" - -#include "speech.h" -#include "speak_lib.h" -#include "phoneme.h" -#include "synthesize.h" -#include "voice.h" -#include "translate.h" - -#define os_X 0x20000 - -// interface to the assembler section -extern "C" { -extern void DMA_Handler(void); - - -// used from the cmhgfile -extern _kernel_oserror *user_init(char *cmd_fail, int podule_base, void *pw); -extern _kernel_oserror *swi_handler(int swi_no, int *r, void *pw); -extern _kernel_oserror *command_handler(char *arg_string, int argc, int cmd_no, void *pw); -extern int callback_handler(_kernel_swi_regs *r, void *pw); -extern int callback_entry(_kernel_swi_regs *r, void *pw); -extern int sound_handler(_kernel_swi_regs *r, void *pw); -extern int sound_entry(_kernel_swi_regs *r, void *pw); - -} - -extern int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume); -extern void RiscosOpenSound(); -extern int WcmdqUsed(); -extern void FreePhData(); -extern void FreeDictionary(); -extern void Write4Bytes(FILE *f, int value); - -extern int wcmdq_head; -extern int wcmdq_tail; -extern int current_source_index; - -FILE *f_text; -FILE *f_wave = NULL; -int (* uri_callback)(int, const char *, const char *) = NULL; -int (* phoneme_callback)(const char *) = NULL; - -int amp = 8; // default - -char path_home[N_PATH_HOME] = ""; -char wavefile[120]; -char textbuffile[L_tmpnam]; -int sample_rate_index; // current value -int current_voice_num=0; -int n_voice_files = 0; -int n_voice_variant_files = 0; - -// output sound buffer, 2 bytes per sample -static unsigned short SoundBuf[4096]; -static void *module_data; -static int callback_inhibit = 0; -static int more_text=0; - -#define N_VOICE_NAMES 60 -#define N_VOICE_VARIANT_NAMES 30 -static char *voice_names[N_VOICE_NAMES]; -static char *voice_variant_names[N_VOICE_VARIANT_NAMES]; - -#define N_STATIC_BUF 8000 -static char static_buf[N_STATIC_BUF]; -static _kernel_oserror errblk; - - - -USHORT voice_pcnt[N_PEAKS+1][3]; - -static const char *help_text = -"\nspeak [options] [\"\"]\n\n" -"-f Text file to speak\n" -//"--stdin Read text input from stdin instead of a file\n\n" -"If neither -f nor --stdin, are spoken, or if none then text is\n" -"spoken from stdin, each line separately.\n\n" -"-a \n" -"\t Amplitude, 0 to 200, default is 100\n" -"-g \n" -"\t Word gap. Pause between words, units of 10mS at the default speed\n" -"-l \n" -"\t Line length. If not zero (which is the default), consider\n" -"\t lines less than this length as end-of-clause\n" -"-p \n" -"\t Pitch adjustment, 0 to 99, default is 50\n" -"-s \n" -"\t Speed in words per minute 80 to 390, default is 170\n" -"-v \n" -"\t Use voice file of this name from espeak-data/voices\n" -"-w \n" -"\t Write output to this WAV file, rather than speaking it directly\n" -"-b\t Input text is 8-bit encoding\n" -"-m\t Interpret SSML markup, and ignore other < > tags\n" -"-q\t Quiet, don't produce any speech (may be useful with -x)\n" -"-x\t Write phoneme mnemonics to stdout\n" -"-X\t Write phonemes mnemonics and translation trace to stdout\n" -//"--stdout Write speech output to stdout\n" -"--compile=\n" -"\t Compile the pronunciation rules and dictionary in the current\n" -"\t directory. = is optional and specifies which language\n" -"--punct=\"\"\n" -"\t Speak the names of punctuation characters during speaking. If\n" -"\t = is omitted, all punctuation is spoken.\n" -"--voices=\n" -"\t List the available voices for the specified language.\n" -"\t If is omitted, then list all voices.\n" -"-k \n" -"\t Indicate capital letters with: 1=sound, 2=the word \"capitals\",\n" -"\t higher values = a pitch increase (try -k20).\n"; - - -int GetFileLength(const char *filename) -{//==================================== - int length=0; - int type; - _kernel_swi_regs regs; - _kernel_oserror *error; - - regs.r[0] = 5; - regs.r[1] = (int)filename; - regs.r[2] = 0; - regs.r[3] = 0; - regs.r[4] = 0; - regs.r[5] = 0; - - error = _kernel_swi(0x20008,®s,®s); - if(error) - return(0); - - type = regs.r[0]; - length = regs.r[4]; - - if(type==2) - return(-2); // a directory - if((type!=1) && (type!=3)) - return(0); /* not a file */ - - return(length); -} /* end of GetFileLength */ - - - -void ReadVoiceNames2(char *directory) -{//================================== - int len; - int path_len; - int *type; - char *p; - _kernel_swi_regs regs; - _kernel_oserror *error; - char buf[80]; - char directory2[sizeof(path_home)+100]; - - regs.r[0] = 10; - regs.r[1] = (int)directory; - regs.r[2] = (int)buf; - regs.r[3] = 1; - regs.r[4] = 0; - regs.r[5] = sizeof(buf); - regs.r[6] = 0; - - path_len = strlen(directory); - - while(regs.r[3] > 0) - { - error = _kernel_swi(0x0c+os_X,®s,®s); /* OS_GBPB 10, read directory entries */ - if((error != NULL) || (regs.r[3] == 0)) - { - break; - } - type = (int *)(&buf[16]); - len = strlen(&buf[20]); - - if(*type == 2) - { - // a sub-directory - sprintf(directory2,"%s.%s",directory,&buf[20]); - ReadVoiceNames2(directory2); - } - else - { - p = (char *)malloc(len+1); - strcpy(p,&buf[20]); - - if(strcmp(&directory[path_len-3],".!v")==0) - { - if(n_voice_variant_files >= (N_VOICE_VARIANT_NAMES-1)) - continue; - voice_variant_names[n_voice_variant_files++] = p; - } - else - { - if(n_voice_files >= (N_VOICE_NAMES-1)) - continue; - voice_names[n_voice_files++] = p; - if(strcmp(p,"en")==0) - { - voice_names[n_voice_files++] = "en+f2"; - } - } - } - } -} - - -void ReadVoiceNames() -{//=================== - char directory[sizeof(path_home)+10]; - - n_voice_files = 0; - n_voice_variant_files = 0; - - sprintf(directory,"%s.voices",path_home); - - ReadVoiceNames2(directory); - - voice_names[n_voice_files] = NULL; - voice_variant_names[n_voice_variant_files] = NULL; -} - - -#ifdef USE_MODULE -char *Alloc(int size) -/*******************/ -{ // version of malloc() for use in RISC_OS module -_kernel_swi_regs regs; - - regs.r[0] = 6; - regs.r[3] = size; - _kernel_swi(0x1e, ®s, ®s); /* OS_Module 6 claim memory */ - - return(char *)regs.r[2]; -} /* end of module_malloc */ - - - -void Free(void *ptr) -/*******************/ -{ // version of free() for use in RISC_OS module -_kernel_swi_regs regs; - - if(ptr == NULL) - return; - - regs.r[0] = 7; - regs.r[2] = (int)(ptr); - _kernel_swi(0x1e, ®s, ®s); /* OS_Module 7 free memory */ -} /* end of Free */ - -#else - -char *Alloc(int size) -{//================== - char *p; - if((p = (char *)malloc(size)) == NULL) - fprintf(stderr,"Can't allocate memory\n"); - return(p); -} - -void Free(void **ptr) -{//================= - if(ptr != NULL) - { - free(ptr); - } -} -#endif - - - - -static int OpenWaveFile(const char *path, int rate) -//================================================= -{ - // Set the length of 0x7fffffff for --stdout - // This will be changed to the correct length for -w (write to file) - static unsigned char wave_hdr[44] = { - 'R','I','F','F',0,0,0,0,'W','A','V','E','f','m','t',' ', - 0x10,0,0,0,1,0,1,0, 9,0x3d,0,0,0x12,0x7a,0,0, - 2,0,0x10,0,'d','a','t','a', 0xff,0xff,0xff,0x7f}; - - if(path == NULL) - return(2); - - if(strcmp(path,"stdout")==0) - f_wave = stdout; - else - f_wave = fopen(path,"wb"); - - if(f_wave != NULL) - { - fwrite(wave_hdr,1,24,f_wave); - Write4Bytes(f_wave,rate); - Write4Bytes(f_wave,rate * 2); - fwrite(&wave_hdr[32],1,12,f_wave); - return(0); - } - return(1); -} // end of OpenWaveFile - - - - -static void CloseWaveFile(int rate) -//================================= -{ - unsigned int pos; - - if((f_wave == NULL) || (f_wave == stdout)) - return; - - fflush(f_wave); - pos = ftell(f_wave); - - fseek(f_wave,4,SEEK_SET); - Write4Bytes(f_wave,pos - 8); - - fseek(f_wave,40,SEEK_SET); - Write4Bytes(f_wave,pos - 44); - - - fclose(f_wave); - f_wave = NULL; - -} // end of CloseWaveFile - - - - -void MarkerEvent(int type, unsigned int char_position, int value, unsigned char *out_ptr) -{//====================================================================================== -// Do nothing in the command-line version. -} // end of MarkerEvent - - -static int WavegenFile(void) -{//========================= - int finished; - unsigned char wav_outbuf[1024]; - - out_ptr = out_start = wav_outbuf; - out_end = wav_outbuf + sizeof(wav_outbuf); - - finished = WavegenFill(0); - - if(f_wave != NULL) - { - fwrite(wav_outbuf, 1, out_ptr - wav_outbuf, f_wave); - } - return(finished); -} // end of WavegenFile - - - - -void FillSoundBuf(int size) -{//======================== -// Fill the buffer with output sound - -// size is number of samples*4 - - size = size; - if(size > sizeof(SoundBuf)) - size = sizeof(SoundBuf); - - out_ptr = (unsigned char *)(&SoundBuf[0]); - out_end = (unsigned char *)(&SoundBuf[size]); - WavegenFill(1); -} - - - -int initialise(void) -{//================= - sprintf(path_home,"%s.espeak-data",""); - if(GetFileLength(path_home) != -2) - { - // not found, try the 10 character version of the directory name - sprintf(path_home,"%s.espeak-dat",""); - } - if(GetFileLength(path_home) != -2) - { - // still can't find data directory - sprintf(errblk.errmess,"Speak: Can't find data directory: '%s'\n",path_home); - return(-1); - } - - WavegenInit(22050,0); - LoadPhData(); - SetVoiceStack(NULL); - SynthesizeInit(); - return(0); -} - - - -void speak_text_string(char *data, int terminator, int len, int wait, int voice_num) -/**********************************************************************************/ -/* 'wait' indictes wait until speaking is finished before returning */ -{ - int c; - int ix; - static static_length=0; - static int user_token=0; /* increment for each call of translate() */ - _kernel_swi_regs regs; - - regs.r[0] = (int)callback_entry; - regs.r[1] = (int)module_data; - _kernel_swi(0x5f, ®s, ®s); - - option_endpause = 1; - - if((voice_num >= 0) && (voice_num != current_voice_num) && (voice_num < N_VOICE_NAMES)) - { - SetVoiceByName(voice_names[voice_num]); - WavegenSetVoice(voice); - } - current_voice_num = voice_num; - - /* don't count CR as terminator if length is specified */ - if(len > 0) terminator = 0; - - ix = 0; - if(more_text == 0) - static_length = 0; - else - { - strcat(&static_buf[static_length]," : "); - static_length+=3; - } - - if(terminator == 0) - { - while(((c = data[ix++]) != 0) && (static_length < N_STATIC_BUF-4)) - { - static_buf[static_length++] = c; - if(ix == len) - break; - } - } - else - { - while(((c = data[ix++]) != '\r') && (c != '\n') && (c != 0) && (static_length < N_STATIC_BUF-3)) - { - static_buf[static_length++] = c; - if(ix == len) - break; - } - } - static_buf[static_length] = 0; - - if(option_waveout==0) - { - if(more_text == 0) - { - InitText(0); - RiscosOpenSound(); - more_text = SpeakNextClause(NULL,(void *)static_buf,0); - } - - while(wait) - { - if((more_text==0) && (wcmdq_head == wcmdq_tail)) - break; - - //we need to block to allow the callback handler to run - regs.r[0] = 129; // wait for key press - regs.r[1] = 10; - regs.r[2] = 0; - _kernel_swi(0x06, ®s, ®s); // OS_Byte - } - } - else - { - more_text = 0; - SpeakNextClause(NULL,(void *)static_buf,0); - - for(;;) - { - if(WavegenFile() != 0) - break; // finished, wavegen command queue is empty - - if(Generate(phoneme_list,&n_phoneme_list,1)==0) - SpeakNextClause(NULL,NULL,1); - } - - CloseWaveFile(samplerate); - } - -} /* end of speak_text_string */ - - - - -void speak_file(char *fname) -{//========================= - FILE *f_in; - char buf[120]; - - f_in = fopen(fname,"r"); - if(f_in == NULL) - { - fprintf(stderr,"Can't read file: '%s'",fname); - return; - } - more_text = 1; - - if(option_waveout == 0) - { - RiscosOpenSound(); - SpeakNextClause(f_in,NULL,0); - } - else - { - more_text = 0; - SpeakNextClause(f_in,NULL,0); - - for(;;) - { - if(WavegenFile() != 0) - break; // finished, wavegen command queue is empty - - if(Generate(phoneme_list,&n_phoneme_list,1)==0) - SpeakNextClause(NULL,NULL,1); - } - - CloseWaveFile(samplerate); - } -} - - - -void set_say_options(int reg2, int reg3) -/**************************************/ -/* Sets options from information in 'say' SWI */ -/* R3 bits 0-7 stress indicator character - bit 8 inhibit unpronouncable check */ -{ - option_linelength = 0; - option_phonemes = 0; - option_waveout = 0; - option_multibyte = 0; // auto - option_capitals = 0; - option_punctuation = 0; - option_punctlist[0] = 0; -} /* end of set_say_options */ - - - -void jsd_swi_functions(int *r) -/****************************/ -{ - espeak_VOICE voice_select; - - switch(r[0]) - { - case 0: /* major version */ - r[0] = 4; - r[1] = 331; - break; - - case 1: /* register user */ - break; - - case 2: /* deregister user */ - break; - - case 3: -// r[0] = (int)speech_to_phonemes((char *)r[1]); - break; - - case 4: -// r[0] = reload_word_dict(NULL); - break; - - case 5: /* get table of voice names */ - r[0] = (int)voice_names; - r[1] = (int)voice_variant_names; - break; - - case 6: /* update voice data, r1 = voice_number */ - if(r[1] < N_VOICE_NAMES) - { - SetVoiceByName(voice_names[r[1]]); - current_voice_num = r[1]; - WavegenSetVoice(voice); - } - break; - - case 7: /* load voice data */ -// init_voice((char *)r[1]); - break; - - case 8: - // list voices, r[1] contains optional language name (or "variant") - voice_select.languages = (char *)r[1]; - voice_select.age = 0; - voice_select.gender = 0; - voice_select.name = NULL; - r[0] = (int)espeak_ListVoices(&voice_select); - break; - - default: - r[0] = 0; - r[1] = 0; - break; - } -} /* end of jsd_swi_functions */ - - - - -_kernel_oserror *swi_handler(int swi_no, int *r, void *pw) -/*********************************************************/ -{ - int value; - int q_length; - int speed; - int amp; - value = r[0]; - - switch(swi_no) - { - - case 0: // ready ? - // returns the index into the source text of the currently speaking word - if(current_source_index > 0) - r[1] = current_source_index-1; - else - r[1] = current_source_index; /* source index */ - r[2] = 0; /* source tag */ - r[3] = 0; /* for future expansion */ - r[4] = 0; - r[5] = 0; - - if(wcmdq_head == wcmdq_tail) - { - r[0] = -1; /* ready, or nearly */ - } - else - r[0] = 0; - break; - - case 1: /* restore old sound channel. DO NOTHING */ - break; - - case 2: /* miscellaneous functions */ - jsd_swi_functions(r); - break; - - case 3: /* speak text */ -// _kernel_irqs_on(); - set_say_options(r[2],r[3]); - speak_text_string((char *)r[0],'\r',r[1],0,r[2]); - break; - - case 4: /* speak text and wait */ -// _kernel_irqs_on(); /* enable interrupts */ - set_say_options(r[2],r[3]); - speak_text_string((char *)r[0],'\r',r[1],1,r[2]); - break; - - case 5: /* stop speaking */ - SpeakNextClause(NULL,NULL,2); - more_text = 0; - break; - - case 7: /* pitch */ - // not implemented - break; - - case 8: /* speed */ - speed = (value * 160)/140; - SetParameter(espeakRATE,speed,0); - break; - - case 9: /* word_gap */ - SetParameter(espeakWORDGAP,value,0); - break; - - case 10: /* pitch_range */ - // not implemented - break; - - case 12: /* reset */ - // not implemented - break; - - case 13: /* volume */ - amp = (value*45)/100; - SetParameter(espeakVOLUME,amp,0); - WavegenSetVoice(voice); - break; - } - return(NULL); -} /* end of swi_handler */ - - - -void PitchAdjust(int pitch_adjustment) -{//=================================== - int ix, factor; - - extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1]; - - voice->pitch_base = (voice->pitch_base * pitch_adjust_tab[pitch_adjustment])/128; - - // adjust formants to give better results for a different voice pitch - factor = 256 + (25 * (pitch_adjustment - 50))/50; - for(ix=0; ix<=5; ix++) - { - voice->freq[ix] = (voice->freq2[ix] * factor)/256; - } -} // end of PitchAdjustment - - - -void DisplayVoices(FILE *f_out, char *language) -{//============================================ - int ix; - const char *p; - int len; - int count; - int scores = 0; - const espeak_VOICE *v; - const char *lang_name; - char age_buf[12]; - const espeak_VOICE **voices; - espeak_VOICE voice_select; - - static char genders[4] = {' ','M','F',' '}; - - if(language[0] == '=') - { - // display only voices for the specified language, in order of priority - voice_select.languages = &language[1]; - voice_select.age = 0; - voice_select.gender = 0; - voice_select.name = NULL; - voices = espeak_ListVoices(&voice_select); - scores = 1; - } - else - { - voices = espeak_ListVoices(NULL); - } - - fprintf(f_out,"Pty Language Age/Gender VoiceName File Other Langs\n"); - - for(ix=0; (v = voices[ix]) != NULL; ix++) - { - count = 0; - p = v->languages; - while(*p != 0) - { - len = strlen(p+1); - lang_name = p+1; - - if(v->age == 0) - strcpy(age_buf," "); - else - sprintf(age_buf,"%3d",v->age); - - if(count==0) - { - fprintf(f_out,"%2d %-12s%s%c %-17s %-11s ", - p[0],lang_name,age_buf,genders[v->gender],v->name,v->identifier); - } - else - { - fprintf(f_out,"(%s %d)",lang_name,p[0]); - } - count++; - p += len+2; - } -// if(scores) -// fprintf(f_out,"%3d ",v->score); - fputc('\n',f_out); - } -} // end of DisplayVoices - - - -char *param_string(char **argp) -{//============================ - char *p; - int ix=0; - static char buf[80]; - - p = *argp; - while(*p == ' ') p++; - while(!isspace(*p)) - buf[ix++] = *p++; - buf[ix]=0; - - *argp = p; - return(buf); -} - -int param_number(char **argp) -{//========================== - int value; - char *p; - - p = *argp; - while(*p == ' ') p++; - - value = atoi(p); - while(!isspace(*p)) p++; - *argp = p; - return(value); -} - -void command_line(char *arg_string, int wait) -{//========================================== - - int option_index = 0; - int c; - int value; - int speed; - int amp; - int wordgap; - int speaking = 0; - int flag_stdin = 0; - int flag_compile = 0; - int error; - int pitch_adjustment = 50; - char filename[80]; - char voicename[40]; - char command[80]; - char *p; - int ix; - - voicename[0] = 0; - wavefile[0] = 0; - filename[0] = 0; - option_linelength = 0; - option_phonemes = 0; - option_waveout = 0; - option_quiet = 0; - option_multibyte = 0; // auto - option_capitals = 0; - option_punctuation = 0; - option_punctlist[0] = 0; - - f_trans = stdout; - - p = arg_string; - - for(;;) - { - while(*p==' ') p++; // skip spaces - if(*p == '\r') break; // end of line - - if(*p == '-') - { - // a command line argument - p++; - switch(*p++) - { - case 'b': - option_multibyte = espeakCHARS_8BIT; - break; - - case 'h': - printf("\nspeak text-to-speech: %s\n%s",version_string,help_text); - return; - - case 'k': - option_capitals = param_number(&p); - SetParameter(espeakCAPITALS,option_capitals,0); - break; - - case 'x': - option_phonemes = 1; - break; - - case 'X': - option_phonemes = 2; - break; - - case 'm': - option_ssml = 1; - break; - - case 'p': - pitch_adjustment = param_number(&p); - break; - - case 'q': - option_quiet = 1; - break; - - case 'f': - strncpy0(filename,param_string(&p),sizeof(filename)); - break; - - case 'l': - option_linelength = param_number(&p); - break; - - case 'a': - amp = param_number(&p); - SetParameter(espeakVOLUME,amp,0); - break; - - case 's': - speed = param_number(&p); - SetParameter(espeakRATE,speed,0); - break; - - case 'g': - wordgap = param_number(&p); - SetParameter(espeakWORDGAP,wordgap,0); - break; - - case 'v': - strncpy0(voicename,param_string(&p),sizeof(voicename)); - break; - - case 'w': - option_waveout=1; - strncpy0(wavefile,param_string(&p),sizeof(wavefile)); - break; - - case '-': - strncpy0(command,param_string(&p),sizeof(command)); - if(memcmp(command,"compile=",8)==0) - { - CompileDictionary(NULL,&command[8],NULL,NULL,0); - return; - } - else - if(memcmp(command,"voices",6)==0) - { - DisplayVoices(stdout,&command[6]); - return; - } - else - if(strcmp(command,"help")==0) - { - printf("\nspeak text-to-speech: %s\n%s",version_string,help_text); - return; - } - else - if(memcmp(command,"punct",5)==0) - { - option_punctuation = 1; - if((command[5]=='=') && (command[6]=='"')) - { - ix = 0; - while((ix < N_PUNCTLIST) && ((option_punctlist[ix] = command[ix+7]) != 0)) ix++; - option_punctlist[N_PUNCTLIST-1] = 0; - option_punctuation = 2; - } - SetParameter(espeakPUNCTUATION,option_punctuation,0); - } - else - { - printf("Command not recognised\n"); - } - break; - - default: - printf("Command not recognised\n"); - break; - } - - } - else - { - break; - } - } - - SetVoiceByName(voicename); - - if((filename[0]==0) && (p[0]=='\r')) - { - // nothing to speak - if(option_quiet) - { - SpeakNextClause(NULL,NULL,2); // stop speaking - more_text = 0; - } - } - - if(option_waveout || option_quiet) - { - // write speech to a WAV file - if(option_quiet) - { - OpenWaveFile(NULL,samplerate); - option_waveout = 2; - } - else - { - if(OpenWaveFile(wavefile,samplerate) != 0) - { - fprintf(stderr,"Can't write to output file '%s'\n'",wavefile); - return; - } - } - } - - if(pitch_adjustment != 50) - { - PitchAdjust(pitch_adjustment); - } - WavegenSetVoice(voice); - - if(filename[0]==0) - speak_text_string(p,'\r',0,wait,-1); - else - speak_file(filename); -} - - - -_kernel_oserror *command_handler(char *arg_string, int argc, int cmd_no, void *pw) -/********************************************************************************/ -{ - switch(cmd_no) - { - case 0: /* Say */ - command_line(arg_string,0); // for compatibility with speak V2 - break; - - case 1: /* Sayw ] */ - command_line(arg_string,0); - break; - - } - return(NULL); -} /* end of cmd_handler */ - - -// sound handler data -int current_sound_handler=0; -int prev_sound_handler=0; -int prev_sound_data=0; -int prev_sound_rate=13; -int sound_handler_changed=0; - - -void RiscosCloseSound() -{//==================== -_kernel_swi_regs regs; - if((sound_handler_changed) && (prev_sound_handler != (int)DMA_Handler)) - { - // check whether current handler is ours - regs.r[0]=0; - _kernel_swi(0x40145,®s,®s); - if(regs.r[1] == (int)DMA_Handler) - { - regs.r[0]=1; - regs.r[1]=prev_sound_handler; - regs.r[2]=prev_sound_data; - _kernel_swi(0x40145,®s,®s); // Sound LinearHandler 1 - - // reset to the previous sample rate - regs.r[0]=3; - regs.r[1]=prev_sound_rate; - _kernel_swi(0x40146,®s,®s); // Sound_SampleRate 3 - - current_sound_handler = prev_sound_handler; - sound_handler_changed = 0; - } - } -} // end of RiscosCloseSound - - - -void RiscosOpenSound() -{//=================== - _kernel_swi_regs regs; - - if(current_sound_handler != (int)DMA_Handler) - { - // register the sound handler - regs.r[0]=1; - regs.r[1]=(int)DMA_Handler; - regs.r[2]=(int)module_data; - _kernel_swi(0x40145,®s,®s); // Sound_LinearHandler 1 - prev_sound_handler = regs.r[1]; - prev_sound_data = regs.r[2]; - - // set the sample rate - regs.r[0]=3; - regs.r[1]=sample_rate_index; - regs.r[2]=0; - _kernel_swi(0x40146,®s,®s); // Sound_SampleRate - prev_sound_rate = regs.r[1]; - - current_sound_handler = (int)DMA_Handler; - sound_handler_changed = 1; - } -} // end of RiscosOpenSound - - - - - -int callback_handler(_kernel_swi_regs *r, void *pw) -/*************************************************/ -{ - if(Generate(phoneme_list,&n_phoneme_list,1)==0) - { - more_text = SpeakNextClause(NULL,NULL,1); - } - - if((WcmdqUsed() == 0) && (more_text == 0)) - { - RiscosCloseSound(); - } - callback_inhibit = 0; - - return(1); -} /* end of callback_handler */ - - - -int sound_handler(_kernel_swi_regs *r, void *pw) -/**********************************************/ -{ - int n_queue; - int size; - int *dma_buf; - int x; - int ix; - - module_data = (int *)pw; - dma_buf = (int *)r->r[1]; - size = (r->r[2] - r->r[1])/4; - FillSoundBuf(size); - - for(ix=0; ixr[0] = 0; - if(callback_inhibit == 0) - { - // set a callback either: - // - queue is low and there is more text to be processed - // - queue is empty and no more text, so callback handler will remove the sound handler - if(((n_queue < 20) && (more_text != 0)) || - ((n_queue==0) && (more_text == 0))) - { - callback_inhibit = 1; - r->r[0] = 1; - r->r[1] = (int)pw; - } - } - return(1); -} - - - - -int InitSound16(int sample_rate) -/******************************/ -/* Find sample rate index */ -{ - int current_rate_index; // current value - - int sound_mode; - int sound_config; - int srate; - int n_srix; - int ix; - _kernel_swi_regs regs; - _kernel_oserror *error; - - sound_mode = 0; - regs.r[0] = 0; - error = _kernel_swi(0x40144+os_X,®s,®s); - sound_mode = regs.r[0]; - sound_config = regs.r[1]; - - if((error == NULL) && (sound_mode == 1)) - { - /* 16 bit sound, find sample rate index */ - regs.r[0] = 0; - regs.r[1] = 0; - _kernel_swi(0x40146,®s,®s); - n_srix = regs.r[1]; - - regs.r[0] = 1; - regs.r[1] = 0; - _kernel_swi(0x40146,®s,®s); - current_rate_index = regs.r[1]; // current sample rate index - srate = regs.r[2]; - for(ix=1; ix<=n_srix; ix++) - { - regs.r[0] = 2; - regs.r[1] = ix; - _kernel_swi(0x40146,®s,®s); - srate = regs.r[2]; - if(srate >= (sample_rate*1024)) - { - return(ix); - } - } - } - return(14); // this was the index for 22050 -} // end of InitSound16 - - - -void RemoveCallback() -/*******************/ -{ - _kernel_swi_regs regs; - - regs.r[0] = (int)callback_entry; - regs.r[1] = (int)module_data; - _kernel_swi(0x5f, ®s, ®s); -} - - -void terminate_module(void) -/*************************/ -{ - RiscosCloseSound(); - RemoveCallback(); - DeleteTranslator(translator); - FreePhData(); -} /* end of terminate_module */ - - -void kill_module(void) -/********************/ -{ - _kernel_swi_regs regs; - regs.r[0]=4; - regs.r[1]=(int)"Speak"; - _kernel_swi(0x1e,®s,®s); /* RMKill */ -} - - -_kernel_oserror *user_init(char *cmd_fail, int podule_base, void *pw) -/*******************************************************************/ -{ - _kernel_swi_regs regs; - _kernel_oserror *error; - int param; - - // It seems that the wctype functions don't work until the locale has been set - // to something other than the default "C". Then, not only Latin1 but also the - // other characters give the correct results with iswalpha() etc. - - static char *locale = "ISO8859-1"; - setlocale(LC_CTYPE,locale); - - module_data = pw; - - sample_rate_index = InitSound16(22050); - - if(initialise() < 0) - { - // exit module, errblk.errmess is set by initialise() - errblk.errnum = 0x101; - return(&errblk); - } - - ReadVoiceNames(); - SetVoiceByName("default"); - - for(param=0; paramtranslator_name == L('h','u')) + { + // lang=Hungarian, If the last two words of a clause have capital letters (eg. a person name), unstress the last word. + if((wflags & (FLAG_LAST_WORD | FLAG_FIRST_UPPER | FLAG_ALL_UPPER | FLAG_FIRST_WORD)) == (FLAG_LAST_WORD | FLAG_FIRST_UPPER)) + { + if((wtab[-1].flags & (FLAG_FIRST_UPPER | FLAG_ALL_UPPER)) == FLAG_FIRST_UPPER) + { + ChangeWordStress(tr,word_phonemes,3); + } + } + } + if((wflags & FLAG_HYPHEN) && (tr->langopts.stress_flags & S_HYPEN_UNSTRESS)) { ChangeWordStress(tr,word_phonemes,3); @@ -1461,6 +1473,7 @@ if(dictionary_flags2[0] & FLAG_ABBREV) ChangeWordStress(tr,word_phonemes,3); } + // dictionary flags for this word give a clue about which alternative pronunciations of // following words to use. if(end_type & SUFX_F)