Browse Source

Use the same logic when calling sox in readclause.c as compiledata.c for portability.

master
Reece H. Dunn 9 years ago
parent
commit
0b187e217e
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      src/libespeak-ng/readclause.c

+ 9
- 7
src/libespeak-ng/readclause.c View File

} }


f = NULL; f = NULL;
#ifdef PLATFORM_POSIX
if ((f = fopen(fname, "rb")) != NULL) { if ((f = fopen(fname, "rb")) != NULL) {
int ix; int ix;
int fd_temp; int fd_temp;
fclose(f); fclose(f);
f = NULL; f = NULL;


#ifdef PLATFORM_POSIX
strcpy(fname_temp, "/tmp/espeakXXXXXX"); strcpy(fname_temp, "/tmp/espeakXXXXXX");
if ((fd_temp = mkstemp(fname_temp)) >= 0) {
if ((fd_temp = mkstemp(fname_temp)) >= 0)
close(fd_temp); close(fd_temp);
sprintf(command, "sox \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp);
if (system(command) == 0)
fname = fname_temp;
}
#else
strcpy(fname_temp, tmpnam(NULL));
#endif

sprintf(command, "sox \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp);
if (system(command) == 0)
fname = fname_temp;
} }
} }
#endif


if (f == NULL) { if (f == NULL) {
f = fopen(fname, "rb"); f = fopen(fname, "rb");

Loading…
Cancel
Save