Browse Source

code cleanup: use statics and consts when possible (#1544)

Contribute to #68
master
Juho Hiltunen 2 years ago
parent
commit
c522d8790d
No account linked to committer's email address

+ 1
- 1
src/libespeak-ng/dictionary.c View File

@@ -424,7 +424,7 @@ void DecodePhonemes(const char *inptr, char *outptr)
}

// using Kirschenbaum to IPA translation, ascii 0x20 to 0x7f
unsigned short ipa1[96] = {
static const unsigned short ipa1[96] = {
0x20, 0x21, 0x22, 0x2b0, 0x24, 0x25, 0x0e6, 0x2c8, 0x28, 0x29, 0x27e, 0x2b, 0x2cc, 0x2d, 0x2e, 0x2f,
0x252, 0x31, 0x32, 0x25c, 0x34, 0x35, 0x36, 0x37, 0x275, 0x39, 0x2d0, 0x2b2, 0x3c, 0x3d, 0x3e, 0x294,
0x259, 0x251, 0x3b2, 0xe7, 0xf0, 0x25b, 0x46, 0x262, 0x127, 0x26a, 0x25f, 0x4b, 0x26b, 0x271, 0x14b, 0x254,

+ 27
- 27
src/libespeak-ng/intonation.c View File

@@ -62,7 +62,7 @@ static int tone_pitch_env; // used to return pitch envelope
#define PITCHfrise 4 // and 3 must be for the variant preceded by 'r'
#define PITCHfrise2 6 // and 5 must be the 'r' variant

unsigned char env_fall[128] = {
const unsigned char env_fall[128] = {
0xff, 0xfd, 0xfa, 0xf8, 0xf6, 0xf4, 0xf2, 0xf0, 0xee, 0xec, 0xea, 0xe8, 0xe6, 0xe4, 0xe2, 0xe0,
0xde, 0xdc, 0xda, 0xd8, 0xd6, 0xd4, 0xd2, 0xd0, 0xce, 0xcc, 0xca, 0xc8, 0xc6, 0xc4, 0xc2, 0xc0,
0xbe, 0xbc, 0xba, 0xb8, 0xb6, 0xb4, 0xb2, 0xb0, 0xae, 0xac, 0xaa, 0xa8, 0xa6, 0xa4, 0xa2, 0xa0,
@@ -73,7 +73,7 @@ unsigned char env_fall[128] = {
0x1e, 0x1c, 0x1a, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0e, 0x0c, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x00
};

unsigned char env_rise[128] = {
static const unsigned char env_rise[128] = {
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e,
0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e,
@@ -84,7 +84,7 @@ unsigned char env_rise[128] = {
0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfd, 0xff
};

unsigned char env_frise[128] = {
static const unsigned char env_frise[128] = {
0xff, 0xf4, 0xea, 0xe0, 0xd6, 0xcc, 0xc3, 0xba, 0xb1, 0xa8, 0x9f, 0x97, 0x8f, 0x87, 0x7f, 0x78,
0x71, 0x6a, 0x63, 0x5c, 0x56, 0x50, 0x4a, 0x44, 0x3f, 0x39, 0x34, 0x2f, 0x2b, 0x26, 0x22, 0x1e,
0x1a, 0x17, 0x13, 0x10, 0x0d, 0x0b, 0x08, 0x06, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -95,7 +95,7 @@ unsigned char env_frise[128] = {
0xa4, 0xa8, 0xac, 0xaf, 0xb3, 0xb7, 0xbb, 0xbf, 0xc3, 0xc7, 0xcb, 0xcf, 0xd3, 0xd7, 0xdb, 0xe0
};

static unsigned char env_r_frise[128] = {
static const unsigned char env_r_frise[128] = {
0xcf, 0xcc, 0xc9, 0xc6, 0xc3, 0xc0, 0xbd, 0xb9, 0xb4, 0xb0, 0xab, 0xa7, 0xa2, 0x9c, 0x97, 0x92,
0x8c, 0x86, 0x81, 0x7b, 0x75, 0x6f, 0x69, 0x63, 0x5d, 0x57, 0x50, 0x4a, 0x44, 0x3e, 0x38, 0x33,
0x2d, 0x27, 0x22, 0x1c, 0x17, 0x12, 0x0d, 0x08, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,
@@ -106,7 +106,7 @@ static unsigned char env_r_frise[128] = {
0xa4, 0xa8, 0xac, 0xaf, 0xb3, 0xb7, 0xbb, 0xbf, 0xc3, 0xc7, 0xcb, 0xcf, 0xd3, 0xd7, 0xdb, 0xe0
};

static unsigned char env_frise2[128] = {
static const unsigned char env_frise2[128] = {
0xff, 0xf9, 0xf4, 0xee, 0xe9, 0xe4, 0xdf, 0xda, 0xd5, 0xd0, 0xcb, 0xc6, 0xc1, 0xbd, 0xb8, 0xb3,
0xaf, 0xaa, 0xa6, 0xa1, 0x9d, 0x99, 0x95, 0x90, 0x8c, 0x88, 0x84, 0x80, 0x7d, 0x79, 0x75, 0x71,
0x6e, 0x6a, 0x67, 0x63, 0x60, 0x5d, 0x59, 0x56, 0x53, 0x50, 0x4d, 0x4a, 0x47, 0x44, 0x41, 0x3e,
@@ -117,7 +117,7 @@ static unsigned char env_frise2[128] = {
0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f, 0x10, 0x12, 0x13, 0x15, 0x17, 0x18, 0x1a, 0x1c, 0x1e, 0x20
};

static unsigned char env_r_frise2[128] = {
static const unsigned char env_r_frise2[128] = {
0xd0, 0xce, 0xcd, 0xcc, 0xca, 0xc8, 0xc7, 0xc5, 0xc3, 0xc1, 0xc0, 0xbd, 0xbb, 0xb8, 0xb5, 0xb3,
0xb0, 0xad, 0xaa, 0xa7, 0xa3, 0xa0, 0x9d, 0x99, 0x96, 0x92, 0x8f, 0x8b, 0x87, 0x84, 0x80, 0x7c,
0x78, 0x74, 0x70, 0x6d, 0x69, 0x65, 0x61, 0x5d, 0x59, 0x55, 0x51, 0x4d, 0x4a, 0x46, 0x42, 0x3e,
@@ -128,7 +128,7 @@ static unsigned char env_r_frise2[128] = {
0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f, 0x10, 0x12, 0x13, 0x15, 0x17, 0x18, 0x1a, 0x1c, 0x1e, 0x20
};

static unsigned char env_risefall[128] = {
static const unsigned char env_risefall[128] = {
0x98, 0x99, 0x99, 0x9a, 0x9c, 0x9d, 0x9f, 0xa1, 0xa4, 0xa7, 0xa9, 0xac, 0xb0, 0xb3, 0xb6, 0xba,
0xbe, 0xc1, 0xc5, 0xc9, 0xcd, 0xd1, 0xd4, 0xd8, 0xdc, 0xdf, 0xe3, 0xe6, 0xea, 0xed, 0xf0, 0xf2,
0xf5, 0xf7, 0xf9, 0xfb, 0xfc, 0xfd, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfd,
@@ -139,7 +139,7 @@ static unsigned char env_risefall[128] = {
0x15, 0x12, 0x0f, 0x0d, 0x0a, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
};

static unsigned char env_rise2[128] = {
static const unsigned char env_rise2[128] = {
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x06, 0x06,
0x07, 0x08, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14,
0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1f, 0x20, 0x22, 0x23, 0x25, 0x26, 0x28, 0x29, 0x2b,
@@ -150,7 +150,7 @@ static unsigned char env_rise2[128] = {
0xdc, 0xdf, 0xe2, 0xe4, 0xe7, 0xe9, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfb, 0xfd
};

static unsigned char env_fall2[128] = {
static const unsigned char env_fall2[128] = {
0xfe, 0xfe, 0xfd, 0xfd, 0xfc, 0xfb, 0xfb, 0xfa, 0xfa, 0xf9, 0xf8, 0xf8, 0xf7, 0xf7, 0xf6, 0xf6,
0xf5, 0xf4, 0xf4, 0xf3, 0xf3, 0xf2, 0xf2, 0xf1, 0xf0, 0xf0, 0xef, 0xee, 0xee, 0xed, 0xec, 0xeb,
0xea, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2, 0xe1, 0xe0, 0xde, 0xdd, 0xdc, 0xdb,
@@ -161,7 +161,7 @@ static unsigned char env_fall2[128] = {
0x18, 0x14, 0x11, 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00
};

static unsigned char env_fallrise3[128] = {
static const unsigned char env_fallrise3[128] = {
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfd, 0xfc, 0xfa, 0xf8, 0xf6, 0xf4, 0xf1, 0xee, 0xeb,
0xe8, 0xe5, 0xe1, 0xde, 0xda, 0xd6, 0xd2, 0xcd, 0xc9, 0xc4, 0xbf, 0xba, 0xb6, 0xb0, 0xab, 0xa6,
0xa1, 0x9c, 0x96, 0x91, 0x8b, 0x86, 0x80, 0x7b, 0x75, 0x6f, 0x6a, 0x64, 0x5f, 0x59, 0x54, 0x4f,
@@ -172,7 +172,7 @@ static unsigned char env_fallrise3[128] = {
0x76, 0x78, 0x7b, 0x7c, 0x7e, 0x80, 0x81, 0x82, 0x83, 0x83, 0x84, 0x84, 0x83, 0x83, 0x82, 0x81
};

static unsigned char env_fallrise4[128] = {
static const unsigned char env_fallrise4[128] = {
0x72, 0x72, 0x71, 0x71, 0x70, 0x6f, 0x6d, 0x6c, 0x6a, 0x68, 0x66, 0x64, 0x61, 0x5f, 0x5c, 0x5a,
0x57, 0x54, 0x51, 0x4e, 0x4b, 0x48, 0x45, 0x42, 0x3f, 0x3b, 0x38, 0x35, 0x32, 0x2f, 0x2c, 0x29,
0x26, 0x23, 0x20, 0x1d, 0x1b, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0e, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
@@ -183,7 +183,7 @@ static unsigned char env_fallrise4[128] = {
0xc0, 0xc7, 0xce, 0xd5, 0xdc, 0xe3, 0xea, 0xf1, 0xf5, 0xf7, 0xfa, 0xfc, 0xfd, 0xfe, 0xff, 0xff
};

static unsigned char env_risefallrise[128] = {
static const unsigned char env_risefallrise[128] = {
0x7f, 0x7f, 0x7f, 0x80, 0x81, 0x83, 0x84, 0x87, 0x89, 0x8c, 0x8f, 0x92, 0x96, 0x99, 0x9d, 0xa1,
0xa5, 0xaa, 0xae, 0xb2, 0xb7, 0xbb, 0xc0, 0xc5, 0xc9, 0xcd, 0xd2, 0xd6, 0xda, 0xde, 0xe2, 0xe6,
0xea, 0xed, 0xf0, 0xf3, 0xf5, 0xf8, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xfe, 0xfd, 0xfc, 0xfb, 0xf9,
@@ -194,7 +194,7 @@ static unsigned char env_risefallrise[128] = {
0x50, 0x5a, 0x64, 0x70, 0x7c, 0x83, 0x85, 0x88, 0x8a, 0x8c, 0x8e, 0x8f, 0x91, 0x92, 0x93, 0x93
};

unsigned char *envelope_data[N_ENVELOPE_DATA] = {
const unsigned char *envelope_data[N_ENVELOPE_DATA] = {
env_fall, env_fall,
env_rise, env_rise,
env_frise, env_r_frise,
@@ -209,15 +209,15 @@ unsigned char *envelope_data[N_ENVELOPE_DATA] = {
};

// indexed by stress
static int min_drop[] = { 6, 7, 9, 9, 20, 20, 20, 25 };
static const int min_drop[] = { 6, 7, 9, 9, 20, 20, 20, 25 };

// pitch change during the main part of the clause
static int drops_0[8] = { 9, 9, 16, 16, 16, 23, 55, 32 };
static const int drops_0[8] = { 9, 9, 16, 16, 16, 23, 55, 32 };

// overflow table values are 64ths of the body pitch range (between body_start and body_end)
static signed char oflow[] = { 0, 40, 24, 8, 0 };
static signed char oflow_emf[] = { 10, 52, 32, 20, 10 };
static signed char oflow_less[] = { 6, 38, 24, 14, 4 };
static const signed char oflow[] = { 0, 40, 24, 8, 0 };
static const signed char oflow_emf[] = { 10, 52, 32, 20, 10 };
static const signed char oflow_less[] = { 6, 38, 24, 14, 4 };

#define N_TONE_HEAD_TABLE 13
#define N_TONE_NUCLEUS_TABLE 13
@@ -229,12 +229,12 @@ typedef struct {
unsigned char body_start;
unsigned char body_end;

int *body_drops;
const int *body_drops;
unsigned char body_max_steps;
char body_lower_u;

unsigned char n_overflow;
signed char *overflow;
const signed char *overflow;
} TONE_HEAD;

typedef struct {
@@ -255,7 +255,7 @@ typedef struct {

#define T_EMPH 1

static TONE_HEAD tone_head_table[N_TONE_HEAD_TABLE] = {
static const TONE_HEAD tone_head_table[N_TONE_HEAD_TABLE] = {
{ 46, 57, 78, 50, drops_0, 3, 7, 5, oflow }, // 0 statement
{ 46, 57, 78, 46, drops_0, 3, 7, 5, oflow }, // 1 comma
{ 46, 57, 78, 46, drops_0, 3, 7, 5, oflow }, // 2 question
@@ -271,7 +271,7 @@ static TONE_HEAD tone_head_table[N_TONE_HEAD_TABLE] = {
{ 46, 57, 55, 50, drops_0, 3, 7, 5, oflow_less }, // 12 test
};

static TONE_NUCLEUS tone_nucleus_table[N_TONE_NUCLEUS_TABLE] = {
static const TONE_NUCLEUS tone_nucleus_table[N_TONE_NUCLEUS_TABLE] = {
{ PITCHfall, 64, 8, PITCHfall, 70, 18, NULL, 24, 12, 0 }, // 0 statement
{ PITCHfrise, 80, 18, PITCHfrise2, 78, 22, NULL, 34, 52, 0 }, // 1 comma
{ PITCHfrise, 88, 22, PITCHfrise2, 82, 22, NULL, 34, 64, 0 }, // 2 question
@@ -418,7 +418,7 @@ static int SetHeadIntonation(SYLLABLE *syllable_tab, TUNE *tune, int syl_ix, int
int overflow_ix = 0;
int pitch_range;
int pitch_range_abs;
int *drops;
const int *drops;
int n_unstressed = 0;
int unstressed_ix = 0;
int unstressed_inc;
@@ -523,7 +523,7 @@ static int SetHeadIntonation(SYLLABLE *syllable_tab, TUNE *tune, int syl_ix, int
/* Calculate pitches until next RESET or tonic syllable, or end.
Increment pitch if stress is >= min_stress.
Used for tonic segment */
static int calc_pitch_segment(SYLLABLE *syllable_tab, int ix, int end_ix, TONE_HEAD *th, TONE_NUCLEUS *tn, int min_stress, bool continuing)
static int calc_pitch_segment(SYLLABLE *syllable_tab, int ix, int end_ix, const TONE_HEAD *th, const TONE_NUCLEUS *tn, int min_stress, bool continuing)
{
int stress;
int pitch = 0;
@@ -535,7 +535,7 @@ static int calc_pitch_segment(SYLLABLE *syllable_tab, int ix, int end_ix, TONE_H
int n_overflow;
int pitch_range;
int pitch_range_abs;
int *drops;
const int *drops;
const signed char *overflow_tab;
SYLLABLE *syl;

@@ -711,8 +711,8 @@ static int calc_pitches2(SYLLABLE *syllable_tab, int start, int end, int tune_n
static int calc_pitches(SYLLABLE *syllable_tab, int control, int start, int end, int tune_number)
{
int ix;
TONE_HEAD *th;
TONE_NUCLEUS *tn;
const TONE_HEAD *th;
const TONE_NUCLEUS *tn;
int drop;
bool continuing = false;


+ 3
- 3
src/libespeak-ng/klatt.c View File

@@ -71,7 +71,7 @@ static klatt_global_t kt_globals;
static int scale_wav_tab[] = { 45, 38, 45, 45, 55, 45 }; // scale output from different voicing sources

// For testing, this can be overwritten in KlattInit()
static short natural_samples2[256] = {
static const short natural_samples2[256] = {
2583, 2516, 2450, 2384, 2319, 2254, 2191, 2127,
2067, 2005, 1946, 1890, 1832, 1779, 1726, 1675,
1626, 1579, 1533, 1491, 1449, 1409, 1372, 1336,
@@ -105,7 +105,7 @@ static short natural_samples2[256] = {
-1680, -1732, -1783, -1839, -1894, -1952, -2010, -2072,
-2133, -2196, -2260, -2325, -2390, -2456, -2522, -2589,
};
static short natural_samples[100] = {
static const short natural_samples[100] = {
-310, -400, 530, 356, 224, 89, 23, -10, -58, -16, 461, 599, 536, 701, 770,
605, 497, 461, 560, 404, 110, 224, 131, 104, -97, 155, 278, -154, -1165,
-598, 737, 125, -592, 41, 11, -247, -10, 65, 92, 80, -304, 71, 167, -1, 122,
@@ -194,7 +194,7 @@ static double sampled_source(int source_num)
int current_value;
int next_value;
double temp_diff;
short *samples;
const short *samples;

if (source_num == 0) {
samples = natural_samples;

+ 1
- 1
src/libespeak-ng/klatt.h View File

@@ -89,7 +89,7 @@ typedef struct {
double amp_gain0; /* G0 converted to linear gain */
int num_samples; /* number of glottal samples */
double sample_factor; /* multiplication factor for glottal samples */
short *natural_samples; /* pointer to an array of glottal samples */
const short *natural_samples; /* pointer to an array of glottal samples */
long original_f0; /* original value of f0 not modified by flutter */

int fadein;

+ 1
- 1
src/libespeak-ng/numbers.c View File

@@ -83,7 +83,7 @@ typedef struct {
} ACCENTS;

// these are tokens to look up in the *_list file.
static ACCENTS accents_tab[] = {
static const ACCENTS accents_tab[] = {
{ "_lig", 1 },
{ "_smc", 0 }, // smallcap
{ "_tur", 0 }, // turned

+ 1
- 1
src/libespeak-ng/phonemelist.c View File

@@ -40,7 +40,7 @@
#include "translate.h"
#include "speech.h"

const unsigned char pause_phonemes[8] = {
static const unsigned char pause_phonemes[8] = {
0, phonPAUSE_VSHORT, phonPAUSE_SHORT, phonPAUSE, phonPAUSE_LONG, phonGLOTTALSTOP, phonPAUSE_LONG, phonPAUSE_LONG
};


+ 5
- 5
src/libespeak-ng/setlengths.c View File

@@ -388,7 +388,7 @@ void CalcLengths(Translator *tr)
int pitch1;

int tone_mod;
unsigned char *pitch_env = NULL;
const unsigned char *pitch_env = NULL;
PHONEME_DATA phdata_tone;


@@ -743,7 +743,7 @@ void CalcLengths(Translator *tr)
// indexes are the "length_mod" value for the following phonemes

// use this table if vowel is not the last in the word
static unsigned char length_mods_en[100] = {
static const unsigned char length_mods_en[100] = {
// a , t s n d z r N <- next
100, 120, 100, 105, 100, 110, 110, 100, 95, 100, // a <- next2
105, 120, 105, 110, 125, 130, 135, 115, 125, 100, // ,
@@ -758,7 +758,7 @@ static unsigned char length_mods_en[100] = {
};

// as above, but for the last syllable in a word
static unsigned char length_mods_en0[100] = {
static const unsigned char length_mods_en0[100] = {
// a , t s n d z r N <- next
100, 150, 100, 105, 110, 115, 110, 110, 110, 100, // a <- next2
105, 150, 105, 110, 125, 135, 140, 115, 135, 100, // ,
@@ -773,7 +773,7 @@ static unsigned char length_mods_en0[100] = {
};


static unsigned char length_mods_equal[100] = {
static const unsigned char length_mods_equal[100] = {
// a , t s n d z r N <- next
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // a <- next2
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // ,
@@ -787,7 +787,7 @@ static unsigned char length_mods_equal[100] = {
110, 120, 100, 110, 110, 110, 110, 110, 110, 110
};

static unsigned char *length_mod_tabs[6] = {
static const unsigned char *const length_mod_tabs[6] = {
length_mods_en,
length_mods_en, // 1
length_mods_en0, // 2

+ 1
- 1
src/libespeak-ng/sintab.h View File

@@ -25,7 +25,7 @@ extern "C"
{
#endif

const short int sin_tab[2048] = {
static const short int sin_tab[2048] = {
0, -25, -50, -75, -100, -125, -150, -175,
-201, -226, -251, -276, -301, -326, -351, -376,
-401, -427, -452, -477, -502, -527, -552, -577,

+ 1
- 1
src/libespeak-ng/speech.c View File

@@ -959,7 +959,7 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Terminate(void)
return ENS_OK;
}

const char *version_string = PACKAGE_VERSION;
static const char version_string[] = PACKAGE_VERSION;
ESPEAK_API const char *espeak_Info(const char **ptr)
{
if (ptr != NULL)

+ 1
- 1
src/libespeak-ng/synth_mbrola.c View File

@@ -241,7 +241,7 @@ static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
int pitch_base;
int pitch_range;
int p1, p2, p_end;
unsigned char *pitch_env;
const unsigned char *pitch_env;
int max = -1;
int min = 999;
int y_max = 0;

+ 1
- 1
src/libespeak-ng/synthdata.c View File

@@ -319,7 +319,7 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params,
return frames;
}

unsigned char *GetEnvelope(int index)
const unsigned char *GetEnvelope(int index)
{
if (index == 0) {
fprintf(stderr, "espeak: No envelope\n");

+ 1
- 1
src/libespeak-ng/synthdata.h View File

@@ -41,7 +41,7 @@ void InterpretPhoneme2(int phcode,
PHONEME_DATA *phdata);

void FreePhData(void);
unsigned char *GetEnvelope(int index);
const unsigned char *GetEnvelope(int index);
espeak_ng_STATUS LoadPhData(int *srate, espeak_ng_ERROR_CONTEXT *context);
int LookupPhonemeString(const char *string);
int LookupPhonemeTable(const char *name);

+ 4
- 4
src/libespeak-ng/synthesize.c View File

@@ -121,7 +121,7 @@ static void EndPitch(int voice_break)
}
}

static void DoAmplitude(int amp, unsigned char *amp_env)
static void DoAmplitude(int amp, const unsigned char *amp_env)
{
intptr_t *q;

@@ -144,7 +144,7 @@ static void DoPhonemeAlignment(char* pho, int type)
WcmdqInc();
}

static void DoPitch(unsigned char *env, int pitch1, int pitch2)
static void DoPitch(const unsigned char *env, int pitch1, int pitch2)
{
intptr_t *q;

@@ -1131,8 +1131,8 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume)
bool pre_voiced;
int free_min;
int value;
unsigned char *pitch_env = NULL;
unsigned char *amp_env;
const unsigned char *pitch_env = NULL;
const unsigned char *amp_env;
PHONEME_TAB *ph;
int use_ipa = 0;
int vowelstart_prev;

+ 3
- 8
src/libespeak-ng/synthesize.h View File

@@ -122,7 +122,7 @@ typedef struct { // 44 bytes
} frame_t2; // without the extra Klatt parameters

typedef struct {
unsigned char *pitch_env;
const unsigned char *pitch_env;
int pitch; // pitch Hz*256
int pitch_ix; // index into pitch envelope (*256)
int pitch_inc; // increment to pitch_ix
@@ -392,12 +392,7 @@ extern int n_phoneme_list;
extern PHONEME_LIST phoneme_list[N_PHONEME_LIST+1];
extern unsigned int embedded_list[];

extern unsigned char env_fall[128];
extern unsigned char env_rise[128];
extern unsigned char env_frise[128];

#define MAX_PITCH_VALUE 101
extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1];
extern const unsigned char env_fall[128];

// queue of commands for wavegen
#define WCMD_KLATT 1
@@ -453,7 +448,7 @@ void DoSonicSpeed(int value);
#define PITCHfall 0 // standard pitch envelopes
#define PITCHrise 2
#define N_ENVELOPE_DATA 20
extern unsigned char *envelope_data[N_ENVELOPE_DATA];
extern const unsigned char *envelope_data[N_ENVELOPE_DATA];

extern int formant_rate[]; // max rate of change of each formant
extern SPEED_FACTORS speed;

+ 3
- 3
src/libespeak-ng/tr_languages.c View File

@@ -61,7 +61,7 @@
#define OFFSET_ETHIOPIC 0x1200

// character ranges must be listed in ascending unicode order
const ALPHABET alphabets[] = {
static const ALPHABET alphabets[] = {
{ "_el", OFFSET_GREEK, 0x380, 0x3ff, L('e', 'l'), AL_DONT_NAME | AL_NOT_LETTERS | AL_WORDS },
{ "_cyr", OFFSET_CYRILLIC, 0x400, 0x52f, 0, 0 },
{ "_hy", OFFSET_ARMENIAN, 0x530, 0x58f, L('h', 'y'), AL_WORDS },
@@ -203,8 +203,8 @@ static const unsigned short chars_ignore_zwnj_hyphen[] = {
0, 0
};

const unsigned char utf8_ordinal[] = { 0xc2, 0xba, 0 }; // masculine ordinal character, UTF-8
const unsigned char utf8_null[] = { 0 }; // null string, UTF-8
static const unsigned char utf8_ordinal[] = { 0xc2, 0xba, 0 }; // masculine ordinal character, UTF-8
static const unsigned char utf8_null[] = { 0 }; // null string, UTF-8

static Translator *NewTranslator(void)
{

+ 2
- 2
src/libespeak-ng/translate.c View File

@@ -896,7 +896,7 @@ static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c,
return SubstituteChar(tr, c, next_in, ptr, insert, wordflags);
}

static const char *UCase_ga[] = { "bp", "bhf", "dt", "gc", "hA", "mb", "nd", "ng", "ts", "tA", "nA", NULL };
static const char *const UCase_ga[] = { "bp", "bhf", "dt", "gc", "hA", "mb", "nd", "ng", "ts", "tA", "nA", NULL };

static int UpperCaseInWord(Translator *tr, char *word, int c)
{
@@ -1791,4 +1791,4 @@ void InitText(int control)

if ((control & espeakKEEP_NAMEDATA) == 0)
InitNamedata();
}
}

+ 2
- 2
src/libespeak-ng/translate.h View File

@@ -431,8 +431,8 @@ typedef struct {
int unstressed_wd1; // stress for $u word of 1 syllable
int unstressed_wd2; // stress for $u word of >1 syllable
int param[N_LOPTS];
unsigned char *length_mods;
unsigned char *length_mods0;
const unsigned char *length_mods;
const unsigned char *length_mods0;

#define NUM_DEFAULT 0x00000001 // enable number processing; use if no other NUM_ option is specified
#define NUM_THOUS_SPACE 0x00000004 // thousands separator must be space

+ 3
- 3
src/libespeak-ng/translateword.c View File

@@ -772,8 +772,8 @@ static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes,
}


static const char *hex_letters[] = {"'e:j", "b'i:", "s'i:", "d'i:", "'i:", "'ef"};
static const char *modifiers[] = { NULL, "_sub", "_sup", NULL };
static const char *const hex_letters[] = {"'e:j", "b'i:", "s'i:", "d'i:", "'i:", "'ef"};
static const char *const modifiers[] = { NULL, "_sub", "_sup", NULL };
// unicode ranges for non-ascii digits 0-9 (these must be in ascending order)
static const int number_ranges[] = {
0x660, 0x6f0, // arabic
@@ -1197,4 +1197,4 @@ static int Unpronouncable2(Translator *tr, char *word)
if ((end_flags == 0) || (end_flags & SUFX_UNPRON))
return 1;
return 0;
}
}

+ 5
- 5
src/libespeak-ng/voices.c View File

@@ -75,10 +75,10 @@ static espeak_VOICE *voices_list[N_VOICES_LIST];
espeak_VOICE current_voice_selected;

#define N_VOICE_VARIANTS 12
const char variants_either[N_VOICE_VARIANTS] = { 1, 2, 12, 3, 13, 4, 14, 5, 11, 0 };
const char variants_male[N_VOICE_VARIANTS] = { 1, 2, 3, 4, 5, 6, 0 };
const char variants_female[N_VOICE_VARIANTS] = { 11, 12, 13, 14, 0 };
const char *variant_lists[3] = { variants_either, variants_male, variants_female };
static const char variants_either[N_VOICE_VARIANTS] = { 1, 2, 12, 3, 13, 4, 14, 5, 11, 0 };
static const char variants_male[N_VOICE_VARIANTS] = { 1, 2, 3, 4, 5, 6, 0 };
static const char variants_female[N_VOICE_VARIANTS] = { 11, 12, 13, 14, 0 };
static const char *const variant_lists[3] = { variants_either, variants_male, variants_female };

static voice_t voicedata;
voice_t *voice = &voicedata;
@@ -1422,4 +1422,4 @@ static int AddToVoicesList(const char *fname, int len_path_voices, int is_langua
return 0;
}
return 0;
}
}

+ 6
- 5
src/libespeak-ng/wavegen.c View File

@@ -124,7 +124,7 @@ static int embedded_max[N_EMBEDDED_VALUES] = { 0, 0x7fff, 750, 300, 99, 99, 99,

#if HAVE_SONIC_H
static sonicStream sonicSpeedupStream = NULL;
double sonicSpeed = 1.0;
static double sonicSpeed = 1.0;
#endif

// 1st index=roughness
@@ -218,7 +218,8 @@ static unsigned char wavemult[N_WAVEMULT] = {
};

// set from y = pow(2,x) * 128, x=-1 to 1
unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1] = {
#define MAX_PITCH_VALUE 101
static const unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1] = {
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 86, 87, 88,
@@ -278,7 +279,7 @@ static void WcmdqIncHead()

#define PEAKSHAPEW 256

unsigned char pk_shape1[PEAKSHAPEW+1] = {
static const unsigned char pk_shape1[PEAKSHAPEW+1] = {
255, 254, 254, 254, 254, 254, 253, 253, 252, 251, 251, 250, 249, 248, 247, 246,
245, 244, 242, 241, 239, 238, 236, 234, 233, 231, 229, 227, 225, 223, 220, 218,
216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 191, 189, 187, 185,
@@ -298,7 +299,7 @@ unsigned char pk_shape1[PEAKSHAPEW+1] = {
0
};

static unsigned char pk_shape2[PEAKSHAPEW+1] = {
static const unsigned char pk_shape2[PEAKSHAPEW+1] = {
255, 254, 254, 254, 254, 254, 254, 254, 254, 254, 253, 253, 253, 253, 252, 252,
252, 251, 251, 251, 250, 250, 249, 249, 248, 248, 247, 247, 246, 245, 245, 244,
243, 243, 242, 241, 239, 237, 235, 233, 231, 229, 227, 225, 223, 221, 218, 216,
@@ -318,7 +319,7 @@ static unsigned char pk_shape2[PEAKSHAPEW+1] = {
0
};

static unsigned char *pk_shape;
static const unsigned char *pk_shape;

void WavegenInit(int rate, int wavemult_fact)
{

Loading…
Cancel
Save