|
|
|
|
|
|
|
|
|
|
|
|
|
|
static REF_HASH_TAB *ref_hash_tab[256]; |
|
|
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 { |
|
|
typedef struct { |
|
|
FILE *file; |
|
|
FILE *file; |
|
|
int linenum; |
|
|
int linenum; |
|
|
|
|
|
|
|
|
return displ | 0x800000; // set bit 23 to indicate a wave file rather than a spectrum |
|
|
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]; |
|
|
char buf[128]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return errno; |
|
|
return errno; |
|
|
fwrite(buf, 128, 1, f_phdata); |
|
|
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; |
|
|
return ENS_OK; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (hash+chars) & 0xff; |
|
|
return (hash+chars) & 0xff; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static int LoadEnvelope2(FILE *f, const char *fname) |
|
|
|
|
|
|
|
|
static int LoadEnvelope2(FILE *f) |
|
|
{ |
|
|
{ |
|
|
int ix, ix2; |
|
|
int ix, ix2; |
|
|
int n; |
|
|
int n; |
|
|
|
|
|
|
|
|
env[x] = y; |
|
|
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); |
|
|
displ = ftell(f_phdata); |
|
|
fwrite(env, 1, ENV_LEN, f_phdata); |
|
|
fwrite(env, 1, ENV_LEN, f_phdata); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*addr = LoadWavefile(f, path); |
|
|
*addr = LoadWavefile(f, path); |
|
|
type_code = 'W'; |
|
|
type_code = 'W'; |
|
|
} else if (id == 0x43544950) { |
|
|
} else if (id == 0x43544950) { |
|
|
status = LoadEnvelope(f, path, addr); |
|
|
|
|
|
|
|
|
status = LoadEnvelope(f, addr); |
|
|
type_code = 'E'; |
|
|
type_code = 'E'; |
|
|
} else if (id == 0x45564E45) { |
|
|
} else if (id == 0x45564E45) { |
|
|
*addr = LoadEnvelope2(f, path); |
|
|
|
|
|
|
|
|
*addr = LoadEnvelope2(f); |
|
|
type_code = 'E'; |
|
|
type_code = 'E'; |
|
|
} else { |
|
|
} else { |
|
|
error("File not SPEC or RIFF: %s", path); |
|
|
error("File not SPEC or RIFF: %s", path); |
|
|
|
|
|
|
|
|
WavegenInit(rate, 0); |
|
|
WavegenInit(rate, 0); |
|
|
WavegenSetVoice(voice); |
|
|
WavegenSetVoice(voice); |
|
|
|
|
|
|
|
|
n_envelopes = 0; |
|
|
|
|
|
error_count = 0; |
|
|
error_count = 0; |
|
|
resample_count = 0; |
|
|
resample_count = 0; |
|
|
memset(markers_used, 0, sizeof(markers_used)); |
|
|
memset(markers_used, 0, sizeof(markers_used)); |