Browse Source

code cleanup: remove unused n_envelopes, N_ENVELOPES, envelope_paths and

envelope_dat.

envelope_dat and envelope_paths were only set but never used.
LoadEnvelope() and LoadEnvelope2() no longer need fname as an argument.
master
Juho Hiltunen 3 years ago
parent
commit
dbcfa71f92
1 changed files with 4 additions and 22 deletions
  1. 4
    22
      src/libespeak-ng/compiledata.c

+ 4
- 22
src/libespeak-ng/compiledata.c View File

@@ -429,11 +429,6 @@ typedef struct {

static REF_HASH_TAB *ref_hash_tab[256];

#define N_ENVELOPES 30
int n_envelopes = 0;
char envelope_paths[N_ENVELOPES][80];
unsigned char envelope_dat[N_ENVELOPES][ENV_LEN];

typedef struct {
FILE *file;
int linenum;
@@ -1340,7 +1335,7 @@ static int LoadWavefile(FILE *f, const char *fname)
return displ | 0x800000; // set bit 23 to indicate a wave file rather than a spectrum
}

static espeak_ng_STATUS LoadEnvelope(FILE *f, const char *fname, int *displ)
static espeak_ng_STATUS LoadEnvelope(FILE *f, int *displ)
{
char buf[128];

@@ -1354,12 +1349,6 @@ static espeak_ng_STATUS LoadEnvelope(FILE *f, const char *fname, int *displ)
return errno;
fwrite(buf, 128, 1, f_phdata);

if (n_envelopes < N_ENVELOPES) {
strncpy0(envelope_paths[n_envelopes], fname, sizeof(envelope_paths[0]));
memcpy(envelope_dat[n_envelopes], buf, sizeof(envelope_dat[0]));
n_envelopes++;
}

return ENS_OK;
}

@@ -1380,7 +1369,7 @@ static int Hash8(const char *string)
return (hash+chars) & 0xff;
}

static int LoadEnvelope2(FILE *f, const char *fname)
static int LoadEnvelope2(FILE *f)
{
int ix, ix2;
int n;
@@ -1431,12 +1420,6 @@ static int LoadEnvelope2(FILE *f, const char *fname)
env[x] = y;
}

if (n_envelopes < N_ENVELOPES) {
strncpy0(envelope_paths[n_envelopes], fname, sizeof(envelope_paths[0]));
memcpy(envelope_dat[n_envelopes], env, ENV_LEN);
n_envelopes++;
}

displ = ftell(f_phdata);
fwrite(env, 1, ENV_LEN, f_phdata);

@@ -1497,10 +1480,10 @@ static espeak_ng_STATUS LoadDataFile(const char *path, int control, int *addr)
*addr = LoadWavefile(f, path);
type_code = 'W';
} else if (id == 0x43544950) {
status = LoadEnvelope(f, path, addr);
status = LoadEnvelope(f, addr);
type_code = 'E';
} else if (id == 0x45564E45) {
*addr = LoadEnvelope2(f, path);
*addr = LoadEnvelope2(f);
type_code = 'E';
} else {
error("File not SPEC or RIFF: %s", path);
@@ -2545,7 +2528,6 @@ espeak_ng_CompilePhonemeDataPath(long rate,
WavegenInit(rate, 0);
WavegenSetVoice(voice);

n_envelopes = 0;
error_count = 0;
resample_count = 0;
memset(markers_used, 0, sizeof(markers_used));

Loading…
Cancel
Save