Browse Source

Merge branch 'upstream' into development

Conflicts:
	dictsource/dict_phonemes
	phsource/compile_report
	platforms/riscos/cpp/speak_riscos
	platforms/riscos/s/cmhgfile
master
Reece Dunn 13 years ago
parent
commit
93aff27021

+ 5
- 0
dictsource/hbs_list View File

@@ -216,6 +216,7 @@ _tld t'ild&
?2 _3C tR'ist'a_
?2 _4C tSetR'ist'o_
_6C S'Est'o

_0M1 t'isUtS;&
_0MA1 t'isUtS;e
_1M1 t'isUtS;U
@@ -226,22 +227,26 @@ _tld t'ild&
?3 _0M1 h'il^ad&
?3 _0MA1 h'il^ade
?3 _1M1 h'il^adU

_0M2 m'ilijUna
_0MA2 m'ilijUna
_1M2 m'ilijUn
?4 _0M2 m'ilijOna
?4 _0MA2 m'ilijOna
?4 _1M2 m'ilijOn

_0M3 m'iliaRdI
_0MA3 m'iliaRde
_1M3 m'iliaRdU
?2 _0M3 milijArdI
?2 _0MA3 milijArde
?2 _1M3 milijArdU

_0M4 b'ilijUna
_1M4 b'ilijUn
?4 _0M4 b'ilijOna
?4 _1M4 b'ilijOn

_dpt _:z'a*Ez_
_roman r*'imsko


+ 54
- 2
dictsource/pt_list View File

@@ -646,46 +646,79 @@ governo gov'ernU $noun

acerto $alt2 $noun
adore $alt
albatrozes $alt
alferes $alt
algozes $alt
atrozes $alt
ameba $alt
belo $alt
besta $alt2
boca $alt2
bolo $alt2
borboleta $alt2
bordo $alt
cabeça $alt2
casebre $alt
catorze $alt2
cerca $alt $verb
cerco $alt $verb
chamego $alt2
chefe $alt
chinelo $alt
coco $alt2
começo $alt2 $noun
comeres $alt2
conheço $alt2
copa $alt
copo $alt
cornos $alt
corpos $alt
corto $alt
corvos $alt
coto $alt2
couber $alt
couberem $alt
couberdes $alt
couberes $alt
der $alt
descova $alt2
desfecho $alt2
dez $alt
doce $alt2
descova $alt2
droga $alt
enumerem $alt
erro $alt2 $noun
esforços $alt
esperma $alt
estrofe $alt
estiverdes $alt
estiveres $alt
farofa $alt
fere $alt
ferem $alt
fezes $alt
fizer $alt
fizerem $alt
fizerdes $alt
fizeres $alt
fogos $alt
fores $alt2
fosse $alt2
fossem $alt2
foste $alt2
frevo $alt2
gelo $alt $verb
germe $alt
grego $alt2
groselha $alt
grosso $alt2
grozo $alt $verb
hoje $alt2
joga $alt
jogam $alt
jogos $alt
jogue $alt
joguem $alt
líderes $alt2
lopes $alt
mantiverdes $alt
@@ -693,8 +726,12 @@ mantiveres $alt
mexa m'eS&
mexi meS'i
mexo m'eSU
miolo $alt2
modo $alt
modos $alt
molho $alt $verb
morcego $alt2
morda $alt2
mortos $alt
?2 mulher mulj'Er
?4 mulher mul^'Er
@@ -702,17 +739,25 @@ mui mwi
muito mw'iNtU // -s is included as a suffix
muita mw'iNt&
mulheres $alt
negro $alt2
novos $alt
onu $1
opereta $alt2
osso $alt2
ovos $alt
paexa paeSa
pedra $alt
pelego $alt2
perdem $alt
perede $alt2
pesa $alt
pesam $alt
pesque $alt
pesquem $alt
peso $alt
peso $alt2 $noun
portos $alt
pose $alt2
povos $alt
preto $alt2
profere $alt
@@ -726,13 +771,15 @@ rogas $alt
selvagem seUv'aZeIN
soco $alt2
sofrem $alt
sofres $alt
sofre $alt
sofreste $alt2
sopre $alt
soprem $alt
souber $alt
souberdes $alt
souberes $alt
souberem $alt
sugere $alt
sugerem $alt
suor swOr
tapete $alt2
@@ -740,12 +787,17 @@ teta $alt2
tiver $alt
tiveres $alt
torres $alt2
tortos $alt
travesso $alt2
trevo $alt2
troco $alt2 $noun
tropeço $alt2 $noun
vanessa $alt2
verbo $alt
verme $alt
vierem $alt
violeta $alt2
vozes $alt

// Close [o]
?1 calculadora $alt2

+ 16
- 0
dictsource/pt_rules View File

@@ -14,6 +14,10 @@
// G a voiced consonant
// K not a vowel

// endings
.L01 a am o
.L02 a am e em o

.group a
_) a (_ a
_) a (_W 'a // in an acronym
@@ -330,6 +334,16 @@
?1 v) e (l_ ,E // eg: possível, amovível, disponível, etc...
?1 l) e (ta 'E // eg: bicicleta, atleta.

_com) e (tL01_ e
_prom) e (tL01_ e
_esqu) e (çL01_ e
_derr) e (tL01_ e
_atr) e (vL01_ e
_f) e (rvL01_ e
_per) e (çL01_ e
_pad) e (çL01_ e
_dec) e (pL02_ E
_p) e (scL01_ E

.group é
é ''E
@@ -614,6 +628,8 @@
?1 f) o (rmulá u // eg: formulário, formulários.
?1 v) o (lt O

_m) o (lhL02_ O


.group ô
ô ''o

+ 11
- 16
platforms/riscos/cpp/speak_riscos View File

@@ -168,6 +168,9 @@ int GetFileLength(const char *filename)
} /* end of GetFileLength */


void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr)
{
}

void ReadVoiceNames2(char *directory)
{//==================================
@@ -222,10 +225,6 @@ void ReadVoiceNames2(char *directory)
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";
}
}
}
}
@@ -416,7 +415,7 @@ int initialise(void)

WavegenInit(22050,0);
LoadPhData();
SetVoiceStack(NULL);
SetVoiceStack(NULL, "");
SynthesizeInit();
return(0);
}
@@ -644,8 +643,6 @@ _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)
@@ -699,8 +696,7 @@ _kernel_oserror *swi_handler(int swi_no, int *r, void *pw)
break;

case 8: /* speed */
speed = (value * 160)/140;
SetParameter(espeakRATE,speed,0);
SetParameter(espeakRATE,value,0);
break;

case 9: /* word_gap */
@@ -716,8 +712,7 @@ _kernel_oserror *swi_handler(int swi_no, int *r, void *pw)
break;

case 13: /* volume */
amp = (value*45)/100;
SetParameter(espeakVOLUME,amp,0);
SetParameter(espeakVOLUME,value,0);
WavegenSetVoice(voice);
break;
}
@@ -729,7 +724,7 @@ _kernel_oserror *swi_handler(int swi_no, int *r, void *pw)
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;
@@ -911,7 +906,7 @@ void command_line(char *arg_string, int wait)
case 'm':
option_ssml = 1;
break;
case 'p':
pitch_adjustment = param_number(&p);
break;
@@ -942,7 +937,7 @@ void command_line(char *arg_string, int wait)
wordgap = param_number(&p);
SetParameter(espeakWORDGAP,wordgap,0);
break;
case 'v':
strncpy0(voicename,param_string(&p),sizeof(voicename));
break;
@@ -1307,8 +1302,8 @@ _kernel_oserror *user_init(char *cmd_fail, int podule_base, void *pw)
for(param=0; param<N_SPEECH_PARAM; param++)
param_stack[0].parameter[param] = param_defaults[param];

SetParameter(espeakRATE,170,0);
SetParameter(espeakVOLUME,65,0);
SetParameter(espeakRATE,175,0);
SetParameter(espeakVOLUME,70,0);

WavegenSetVoice(voice);
atexit(terminate_module);

+ 1
- 1
platforms/riscos/s/cmhgfile View File

@@ -3,7 +3,7 @@
initialisation-code: user_init

title-string: Speak
help-string: Speak 3.40 Text to Speech (32 bit)
help-string: Speak 3.46 Text to Speech (32 bit)

swi-chunk-base-number: &4ad80
swi-handler-code: swi_handler

+ 1
- 0
platforms/windows/espeakedit/src/speech.h View File

@@ -28,6 +28,7 @@
//#define SPECT_EDITOR
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC
#include <windows.h>
#define PLATFORM_WINDOWS

+ 1
- 0
platforms/windows/espeakedit/src_copy/speech.h View File

@@ -28,6 +28,7 @@
//#define SPECT_EDITOR
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC
#include <windows.h>
#define PLATFORM_WINDOWS

+ 2
- 0
platforms/windows/windows_cmd/src/speech.h View File

@@ -36,6 +36,8 @@
#define NO_VARIADIC_MACROS
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC
// will look for espeak_data directory here, and also in user's home directory
#define PATH_ESPEAK_DATA "/usr/share/espeak-data"

+ 2
- 0
platforms/windows/windows_dll/src/speech.h View File

@@ -39,6 +39,8 @@
#define LIBRARY
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC


// will look for espeak_data directory here, and also in user's home directory
#define PATH_ESPEAK_DATA "/usr/share/espeak-data"

+ 2
- 0
platforms/windows/windows_sapi/src/speech.h View File

@@ -41,6 +41,8 @@
//#define USE_NANOSLEEP
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC
// will look for espeak_data directory here, and also in user's home directory
#define PATH_ESPEAK_DATA "/usr/share/espeak-data"

+ 32
- 25
src/numbers.cpp View File

@@ -984,39 +984,46 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)

static const char *M_Variant(int value)
{//====================================
// returns M, or perhaps MA for some cases
// returns M, or perhaps MA or MB for some cases
if(translator->translator_name == L('l','t'))
int teens = 0;

if(((value % 100) > 10) && ((value % 100) < 20))
teens = 1;

switch((translator->langopts.numbers2 >> 6) & 0x7)
{
// Lithuanian
if((value % 10) == 1)
case 1: // lang=ru use singular for xx1 except for x11
if((teens == 0) && ((value % 10) == 1))
return("1M");
break;

case 2: // lang=cs,sk
if((value >= 2) && (value <= 4))
return("0MA");
if(((value % 10) == 0) || ((value % 100) > 10) && ((value % 100) < 20))
{
return("0MB");
}
return("0M");
}
break;

if((translator->langopts.numbers2 & 0x100) && (value >= 2) && (value <= 4))
return("0MA"); // Czech, Slovak
else
if(((value % 100) < 10) || ((value % 100) > 20)) // but not teens, 10 to 19
{
if ((translator->langopts.numbers2 & 0x40) &&
((value % 10)>=2) &&
((value % 10)<=4))
{
// for Polish language - two forms of plural!
case 3: // lang=pl
if((teens == 0) && (((value % 10) >= 2) && ((value % 10) <= 4)))
return("0MA");
}
break;

case 4: // lang=lt
if((teens == 1) || ((value % 10) == 0))
return("0MB");
if((value % 10) == 1)
return("0MA");
break;

if((translator->langopts.numbers2 & 0x80) &&
((value % 10)==1))
case 5: // lang=bs,hr,sr
if(teens == 0)
{
return("1MA");
if((value % 10) == 1)
return("1M");
if(((value % 10) >= 2) && ((value % 10) <= 4))
return("0MA");
}

break;
}
return("0M");
}

+ 1
- 1
src/readclause.cpp View File

@@ -1591,7 +1591,7 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp)
static int ReplaceKeyName(char *outbuf, int index, int &outix)
{//===========================================================
// Replace some key-names by single characters, so they can be pronounced in different languages
MNEM_TAB keynames[] = {
static MNEM_TAB keynames[] = {
{"space ",0xe020},
{"tab ", 0xe009},
{"underscore ", 0xe05f},

+ 143
- 0
src/setlengths.cpp View File

@@ -136,6 +136,8 @@ static int speed3 = 118;

//#define TEST_SPEED

#ifdef INCLUDE_SONIC

void SetSpeed(int control)
{//=======================
int x;
@@ -312,6 +314,147 @@ printf("%3d: speedf %d %d %d pause=%d %d wav=%d lenmod=%d %d\n",wpm,speed1,
#endif
} // end of SetSpeed

#else // not using sonic speed-up

void SetSpeed(int control)
{//=======================
// This is the earlier version of SetSpeed() before sonic speed-up was added
int x;
int s1;
int wpm;
int wpm2;

speed.loud_consonants = 0;
speed.min_sample_len = 450;
speed.lenmod_factor = 110; // controls the effect of FRFLAG_LEN_MOD reduce length change
speed.lenmod2_factor = 100;

wpm = embedded_value[EMBED_S];
if(control == 2)
wpm = embedded_value[EMBED_S2];

#ifdef TEST_SPEED
if(wpm > 1000)
{
// TESTING
test = wpm / 1000;
wpm = wpm % 1000;
}
#endif

if(voice->speed_percent > 0)
{
wpm = (wpm * voice->speed_percent)/100;
}
if(wpm > 450)
wpm = 450;

if(wpm > 360)
{
speed.loud_consonants = (wpm - 360) / 8;
}

wpm2 = wpm;
if(wpm > 359) wpm2 = 359;
if(wpm < 80) wpm2 = 80;
x = speed_lookup[wpm2-80];

if(wpm >= 380)
x = 7;
if(wpm >= 400)
x = 6;

if(control & 1)
{
// set speed factors for different syllable positions within a word
// these are used in CalcLengths()
speed1 = (x * voice->speedf1)/256;
speed2 = (x * voice->speedf2)/256;
speed3 = (x * voice->speedf3)/256;

if(x <= 7)
{
speed1 = x;
speed2 = speed3 = x - 1;
}
}

if(control & 2)
{
// these are used in synthesis file

if(wpm > 350)
{
speed.lenmod_factor = 85 - (wpm - 350) / 3;
speed.lenmod2_factor = 60 - (wpm - 350) / 8;
}
else
if(wpm > 250)
{
speed.lenmod_factor = 110 - (wpm - 250)/4;
speed.lenmod2_factor = 110 - (wpm - 250)/2;
}

s1 = (x * voice->speedf1)/256;

if(wpm >= 170)
speed.wav_factor = 110 + (150*s1)/128; // reduced speed adjustment, used for playing recorded sounds
else
speed.wav_factor = 128 + (128*s1)/130; // = 215 at 170 wpm

if(wpm >= 350)
{
speed.wav_factor = wav_factor_350[wpm-350];
}

if(wpm >= 390)
{
speed.min_sample_len = 450 - (wpm - 400)/2;
if(wpm > 440)
speed.min_sample_len = 420 - (wpm - 440);
}

speed.pause_factor = (256 * s1)/115; // full speed adjustment, used for pause length
speed.clause_pause_factor = 0;

if(wpm > 430)
{
speed.pause_factor = 12;
// speed.clause_pause_factor = 15;
}
else
if(wpm > 400)
{
speed.pause_factor = 13;
// speed.clause_pause_factor = 15;
}
else
if(wpm > 374)
{
speed.pause_factor = 14;
}
else
if(wpm > 350)
{
speed.pause_factor = pause_factor_350[wpm - 350];
}

if(speed.clause_pause_factor == 0)
{
// restrict the reduction of pauses between clauses
if((speed.clause_pause_factor = speed.pause_factor) < 16)
speed.clause_pause_factor = 16;
}
}

#ifdef TEST_SPEED
//if(control==3)
printf("%3d: speedf %d %d %d pause=%d %d wav=%d lenmod=%d %d\n",wpm,speed1,speed2,speed3, speed.pause_factor,speed.clause_pause_factor, speed.wav_factor,speed.lenmod_factor,speed.lenmod2_factor);
#endif
} // end of SetSpeed

#endif // of INCLUDE_SONIC


#ifdef deleted
void SetAmplitude(int amp)

+ 5
- 0
src/sonic.cpp View File

@@ -20,11 +20,15 @@

#include "StdAfx.h"


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

#include "speech.h"
#include "sonic.h"
#ifdef INCLUDE_SONIC

struct sonicStreamStruct {
short *inputBuffer;
@@ -965,3 +969,4 @@ int sonicChangeShortSpeed(
sonicDestroyStream(stream);
return numSamples;
}
#endif // INCLUDE_SONIC

+ 1
- 0
src/speech.h View File

@@ -25,6 +25,7 @@
// conditional compilation options
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC

#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
#define ARCH_BIG

+ 2
- 2
src/synthdata.cpp View File

@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"

const char *version_string = "1.46.21 25.Jul.12";
const char *version_string = "1.46.22 09.Aug.12";
const int version_phdata = 0x014600;

int option_device_number = -1;
@@ -975,7 +975,7 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
if(instn2 < 8)
{
// ChangeIf
if(StressCondition(tr, plist, instn2 & 7, 1))
if(StressCondition(tr, plist, instn2 & 7, 1) == true)
{
phdata->pd_param[i_CHANGE_PHONEME] = instn & 0xff;
end_flag = 1; // change phoneme, exit

+ 2
- 0
src/synthesize.cpp View File

@@ -1237,6 +1237,7 @@ void DoPhonemeMarker(int type, int char_posn, int length, char *name)
} // end of DoMarker


#ifdef INCLUDE_SONIC
void DoSonicSpeed(int value)
{//=========================
// value, multiplier * 1024
@@ -1244,6 +1245,7 @@ void DoSonicSpeed(int value)
wcmdq[wcmdq_tail][1] = value;
WcmdqInc();
} // end of DoSonicSpeed
#endif


void DoVoiceChange(voice_t *v)

+ 8
- 10
src/tr_languages.cpp View File

@@ -118,8 +118,8 @@ static const unsigned short chars_ignore_default[] = {
0, 0 };

// alternatively, ignore characters but allow zero-width-non-joiner (lang-fa)
static const unsigned short chars_ignore_fa[] = {
0x200c, 0x0605, // zero width non-joiner, replace with not-used Arabic character code
static const unsigned short chars_ignore_zwnj_hyphen[] = {
0x200c, '-', // zero width non-joiner, replace with hyphen
0x200d, 1, // zero width joiner
0, 0 };

@@ -661,13 +661,11 @@ Translator *SelectTranslator(const char *name)

case L('f','a'): // Farsi
{
static const char fa_ZWNJ[] = {0x05, 0}; // use letter group G for ZWNJ U+200c
tr->letter_bits_offset = OFFSET_ARABIC;
tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND;
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words

tr->chars_ignore = chars_ignore_fa;
SetLetterBits(tr,LETTERGP_G,(char *)fa_ZWNJ);
tr->chars_ignore = chars_ignore_zwnj_hyphen; // replace ZWNJ by hyphen
}
break;

@@ -763,7 +761,7 @@ Translator *SelectTranslator(const char *name)
tr->langopts.accents = 1;

tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS;
tr->langopts.numbers2 = 0x4a; // variant numbers before thousands,milliards
tr->langopts.numbers2 = 0xa + NUM2_THOUSANDS_VAR5; // variant numbers before thousands,milliards
tr->langopts.replace_chars = replace_cyrillic_latin;

SetLetterVowel(tr,'y');
@@ -999,7 +997,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.unstressed_wd2 = 2;
tr->langopts.param[LOPT_DIERESES] = 1;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT;
tr->langopts.numbers2 = 0x100;
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR4;
tr->langopts.max_roman = 5000;
}
break;
@@ -1098,7 +1096,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x9;
tr->langopts.max_initial_consonants = 7; // for example: wchrzczony :)
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2;
tr->langopts.numbers2 = 0x40;
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR3;
tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt)
SetLetterVowel(tr,'y');
}
@@ -1170,7 +1168,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word

tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN;
tr->langopts.numbers2 = 0x100;
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR2;
tr->langopts.thousands_sep = STRESSPOSN_1L; //no thousands separator
tr->langopts.decimal_sep = ',';

@@ -1478,7 +1476,7 @@ static void Translator_Russian(Translator *tr)
tr->langopts.stress_flags = 0x0020; // waas 0x1010

tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED;
tr->langopts.numbers2 = 0xc2; // variant numbers before thousands
tr->langopts.numbers2 = 0x2 + NUM2_THOUSANDS_VAR1; // variant numbers before thousands
tr->langopts.phoneme_change = 1;
tr->langopts.testing = 2;


+ 2
- 2
src/translate.cpp View File

@@ -372,7 +372,7 @@ int IsAlpha(unsigned int c)
{//========================
// Replacement for iswalph() which also checks for some in-word symbols

const unsigned short extra_indic_alphas[] = {
static const unsigned short extra_indic_alphas[] = {
0xa70,0xa71, // Gurmukhi: tippi, addak
0 };

@@ -1013,7 +1013,7 @@ if((wmark > 0) && (wmark < 8))
found = TranslateNumber(tr, word1, phonemes, dictionary_flags, wtab, 0);
}

if(!found & ((wflags & FLAG_UPPERS) != FLAG_FIRST_UPPER))
if(!found && ((wflags & FLAG_UPPERS) != FLAG_FIRST_UPPER))
{
// either all upper or all lower case


+ 6
- 3
src/translate.h View File

@@ -446,10 +446,13 @@ typedef struct {

#define NUM2_MULTIPLE_ORDINAL 0x1000
#define NUM2_ENGLISH_NUMERALS 0x2000
#define NUM2_THOUSANDS_VAR1 0x40
#define NUM2_THOUSANDS_VAR2 0x80
#define NUM2_THOUSANDS_VAR3 0xc0
#define NUM2_THOUSANDS_VAR4 0x100
#define NUM2_THOUSANDS_VAR5 0x140
// bits 1-4 use variant form of numbers before thousands,millions,etc.
// bit6=(LANG=pl) two forms of plural, M or MA
// bit7=(LANG-ru) use MB for 1 thousand, million, etc
// bit8=(LANG=cs,sk) two forms of plural, M or MA
// bits 6-8 use different forms of thousand, million, etc (M MA MB)
// bit9=(LANG=rw) say "thousand" and "million" before its number, not after
// bit12=(LANG=el,es) use ordinal form of hundreds and tens as well as units
// bit13=(LANG=ne) speak (non-replaced) English numerals in English

+ 22
- 4
src/wavegen.cpp View File

@@ -34,9 +34,10 @@
#include "phoneme.h"
#include "synthesize.h"
#include "voice.h"
#include "sonic.h"

//#undef INCLUDE_KLATT
#ifdef INCLUDE_SONIC
#include "sonic.h"
#endif

#ifdef USE_PORTAUDIO
#include "portaudio.h"
@@ -150,8 +151,10 @@ static PortAudioStream *pa_stream=NULL;
static PaStream *pa_stream=NULL;
#endif

#ifdef INCLUDE_SONIC
static sonicStream sonicSpeedupStream = NULL;
double sonicSpeed = 1.0;
#endif

// 1st index=roughness
// 2nd index=modulation_type
@@ -295,11 +298,15 @@ void WcmdqStop()
{//=============
wcmdq_head = 0;
wcmdq_tail = 0;

#ifdef INCLUDE_SONIC
if(sonicSpeedupStream != NULL)
{
sonicDestroyStream(sonicSpeedupStream);
sonicSpeedupStream = NULL;
}
#endif

#ifdef USE_PORTAUDIO
Pa_AbortStream(pa_stream);
#endif
@@ -1912,14 +1919,18 @@ int WavegenFill2(int fill_zeros)
}
wdata.n_mix_wavefile = 0;
wdata.amplitude_fmt = 100;
#ifdef INCLUDE_KLATT
KlattReset(1);
#endif
result = PlaySilence(length,resume);
break;

case WCMD_WAVE:
echo_complete = echo_length;
wdata.n_mix_wavefile = 0;
#ifdef INCLUDE_KLATT
KlattReset(1);
#endif
result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8);
break;

@@ -1989,9 +2000,11 @@ int WavegenFill2(int fill_zeros)
wdata.amplitude_fmt = 100; // percentage, but value=0 means 100%
break;

#ifdef INCLUDE_SONIC
case WCMD_SONIC_SPEED:
sonicSpeed = (double)q[1] / 1024;
break;
#endif
}

if(result==0)
@@ -2009,6 +2022,7 @@ int WavegenFill2(int fill_zeros)
} // end of WavegenFill2


#ifdef INCLUDE_SONIC
/* Speed up the audio samples with libsonic. */
static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text)
{//==============================================================================
@@ -2035,6 +2049,7 @@ static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text
}
return sonicReadShortFromStream(sonicSpeedupStream, outbuf, length_out);
} // end of SpeedUp
#endif


/* Call WavegenFill2, and then speed up the output samples. */
@@ -2042,16 +2057,18 @@ int WavegenFill(int fill_zeros)
{//============================
int finished;
unsigned char *p_start;
int length;
int max_length;

p_start = out_ptr;

// fill_zeros is ignored. It is now done in the portaudio callback
finished = WavegenFill2(0);

#ifdef INCLUDE_SONIC
if(sonicSpeed > 1.0)
{
int length;
int max_length;

max_length = (out_end - p_start);
length = 2*SpeedUp((short *)p_start, (out_ptr-p_start)/2, max_length/2, finished);
out_ptr = p_start + length;
@@ -2059,6 +2076,7 @@ int WavegenFill(int fill_zeros)
if(length >= max_length)
finished = 0; // there may be more data to flush
}
#endif
return finished;
} // end of WavegenFill


Loading…
Cancel
Save