Browse Source

Support loading phoneme data files relative to the phsrc path.

master
Reece H. Dunn 8 years ago
parent
commit
0367abf98f
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      src/libespeak-ng/compiledata.c

+ 6
- 6
src/libespeak-ng/compiledata.c View File



NAMETAB *manifest = NULL; NAMETAB *manifest = NULL;
int n_manifest; int n_manifest;
char phsrc[sizeof(path_home)+40]; // Source: path to the 'phonemes' source file.


extern ESPEAK_NG_API int utf8_in(int *c, const char *buf); extern ESPEAK_NG_API int utf8_in(int *c, const char *buf);
extern int utf8_out(unsigned int c, char *buf); extern int utf8_out(unsigned int c, char *buf);
if (spectseq == NULL) if (spectseq == NULL)
return ENOMEM; return ENOMEM;


snprintf(filename, sizeof(filename), "%s/../phsource/%s", path_home, path);
snprintf(filename, sizeof(filename), "%s/%s", phsrc, path);
espeak_ng_STATUS status = LoadSpectSeq(spectseq, filename); espeak_ng_STATUS status = LoadSpectSeq(spectseq, filename);
if (status != ENS_OK) { if (status != ENS_OK) {
error("Bad vowel file: '%s'", path); error("Bad vowel file: '%s'", path);
fname2 = msg; fname2 = msg;
} }


sprintf(command, "sox \"%s/../phsource/%s.wav\" -r %d -c1 -t wav %s\n", path_home, fname2, samplerate_native, fname_temp);
sprintf(command, "sox \"%s/%s.wav\" -r %d -c1 -t wav %s\n", phsrc, fname2, samplerate_native, fname_temp);
if (system(command) != 0) if (system(command) != 0)
failed = 1; failed = 1;


} }


if (*addr == 0) { if (*addr == 0) {
sprintf(buf, "%s/../phsource/%s", path_home, path);
sprintf(buf, "%s/%s", phsrc, path);


if ((f = fopen(buf, "rb")) == NULL) { if ((f = fopen(buf, "rb")) == NULL) {
sprintf(buf, "%s/../phsource/%s.wav", path_home, path);
sprintf(buf, "%s/%s.wav", phsrc, path);
if ((f = fopen(buf, "rb")) == NULL) { if ((f = fopen(buf, "rb")) == NULL) {
error("Can't read file: %s", path); error("Can't read file: %s", path);
return errno; return errno;
break; // ignore bytes 0xef 0xbb 0xbf break; // ignore bytes 0xef 0xbb 0xbf
case kINCLUDE: case kINCLUDE:
NextItem(tSTRING); NextItem(tSTRING);
sprintf(buf, "%s/../phsource/%s", path_home, item_string);
sprintf(buf, "%s/%s", phsrc, item_string);


if ((stack_ix < N_STACK) && (f = fopen(buf, "rb")) != NULL) { if ((stack_ix < N_STACK) && (f = fopen(buf, "rb")) != NULL) {
stack[stack_ix].linenum = linenum; stack[stack_ix].linenum = linenum;
if (!log) log = stderr; if (!log) log = stderr;


char fname[sizeof(path_home)+40]; char fname[sizeof(path_home)+40];
char phsrc[sizeof(path_home)+40]; // Source: path to the 'phonemes' source file.
char phdst[sizeof(path_home)+40]; // Destination: path to the phondata/phontab/phonindex output files. char phdst[sizeof(path_home)+40]; // Destination: path to the phondata/phontab/phonindex output files.


if (source_path) { if (source_path) {

Loading…
Cancel
Save