mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-01 05:46:19 +00:00
Program restructure and tidy-up.
Change Translator from Class to Struct, so avoiding use of Classes in eSpeak. Make more functions and variables "extern". git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@209 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+18
-18
@@ -253,8 +253,8 @@ static void DoEmbedded2(int &embix)
|
||||
}
|
||||
|
||||
|
||||
void Translator::CalcLengths()
|
||||
{//===========================
|
||||
void CalcLengths(Translator *tr)
|
||||
{//==============================
|
||||
int ix;
|
||||
int ix2;
|
||||
PHONEME_LIST *prev;
|
||||
@@ -318,14 +318,14 @@ void Translator::CalcLengths()
|
||||
if(prev->type == phSTOP)
|
||||
p->prepause = 60;
|
||||
|
||||
if((langopts.word_gap & 0x10) && (p->newword))
|
||||
if((tr->langopts.word_gap & 0x10) && (p->newword))
|
||||
p->prepause = 60;
|
||||
|
||||
if(p->ph->phflags & phLENGTHENSTOP)
|
||||
p->prepause += 30;
|
||||
|
||||
if(p->synthflags & SFLAG_LENGTHEN)
|
||||
p->prepause += langopts.long_stop;
|
||||
p->prepause += tr->langopts.long_stop;
|
||||
break;
|
||||
|
||||
case phVFRICATIVE:
|
||||
@@ -353,7 +353,7 @@ void Translator::CalcLengths()
|
||||
else
|
||||
p->length = 256;
|
||||
|
||||
if((langopts.word_gap & 0x10) && (p->newword))
|
||||
if((tr->langopts.word_gap & 0x10) && (p->newword))
|
||||
p->prepause = 30;
|
||||
|
||||
break;
|
||||
@@ -383,14 +383,14 @@ void Translator::CalcLengths()
|
||||
p->prepause = 0;
|
||||
}
|
||||
}
|
||||
if((langopts.word_gap & 0x10) && (p->newword) && (p->prepause < 20))
|
||||
if((tr->langopts.word_gap & 0x10) && (p->newword) && (p->prepause < 20))
|
||||
p->prepause = 20;
|
||||
|
||||
break;
|
||||
|
||||
case phLIQUID:
|
||||
case phNASAL:
|
||||
p->amp = stress_amps[1]; // unless changed later
|
||||
p->amp = tr->stress_amps[1]; // unless changed later
|
||||
p->length = 256; // TEMPORARY
|
||||
min_drop = 0;
|
||||
|
||||
@@ -457,9 +457,9 @@ void Translator::CalcLengths()
|
||||
if(stress > 7) stress = 7;
|
||||
|
||||
if(pre_sonorant)
|
||||
p->amp = stress_amps[stress]-1;
|
||||
p->amp = tr->stress_amps[stress]-1;
|
||||
else
|
||||
p->amp = stress_amps[stress];
|
||||
p->amp = tr->stress_amps[stress];
|
||||
|
||||
if(emphasized)
|
||||
p->amp = 25;
|
||||
@@ -467,8 +467,8 @@ void Translator::CalcLengths()
|
||||
if(ix >= (n_phoneme_list-3))
|
||||
{
|
||||
// last phoneme of a clause, limit its amplitude
|
||||
if(p->amp > langopts.param[LOPT_MAXAMP_EOC])
|
||||
p->amp = langopts.param[LOPT_MAXAMP_EOC];
|
||||
if(p->amp > tr->langopts.param[LOPT_MAXAMP_EOC])
|
||||
p->amp = tr->langopts.param[LOPT_MAXAMP_EOC];
|
||||
}
|
||||
|
||||
// is the last syllable of a word ?
|
||||
@@ -501,19 +501,19 @@ void Translator::CalcLengths()
|
||||
|
||||
if(more_syllables==0)
|
||||
{
|
||||
len = langopts.length_mods0[next2->ph->length_mod *10+ next->ph->length_mod];
|
||||
len = tr->langopts.length_mods0[next2->ph->length_mod *10+ next->ph->length_mod];
|
||||
|
||||
if((next->newword) && (langopts.word_gap & 0x20))
|
||||
if((next->newword) && (tr->langopts.word_gap & 0x20))
|
||||
{
|
||||
// consider as a pause + first phoneme of the next word
|
||||
length_mod = (len + langopts.length_mods0[next->ph->length_mod *10+ 1])/2;
|
||||
length_mod = (len + tr->langopts.length_mods0[next->ph->length_mod *10+ 1])/2;
|
||||
}
|
||||
else
|
||||
length_mod = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
length_mod = langopts.length_mods[next2->ph->length_mod *10+ next->ph->length_mod];
|
||||
length_mod = tr->langopts.length_mods[next2->ph->length_mod *10+ next->ph->length_mod];
|
||||
|
||||
if((next->type == phNASAL) && (next2->type == phSTOP || next2->type == phVSTOP) && (next3->ph->phflags & phFORTIS))
|
||||
length_mod -= 15;
|
||||
@@ -546,8 +546,8 @@ void Translator::CalcLengths()
|
||||
length_mod += 20;
|
||||
}
|
||||
|
||||
if((len = stress_lengths[stress]) == 0)
|
||||
len = stress_lengths[6];
|
||||
if((len = tr->stress_lengths[stress]) == 0)
|
||||
len = tr->stress_lengths[6];
|
||||
|
||||
length_mod = (length_mod * len)/128;
|
||||
|
||||
@@ -564,7 +564,7 @@ void Translator::CalcLengths()
|
||||
{
|
||||
// this is the last syllable in the clause, lengthen it - more for short vowels
|
||||
len = p->ph->std_length;
|
||||
if(langopts.stress_flags & 0x40000)
|
||||
if(tr->langopts.stress_flags & 0x40000)
|
||||
len=200; // don't lengthen short vowels more than long vowels at end-of-clause
|
||||
length_mod = length_mod * (256 + (280 - len)/3)/256;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user