Browse Source

Fix #715: Need better error messages if MBROLA engine or voice files are missing

master
Valdis Vitolins 5 years ago
parent
commit
3f3f17f843
2 changed files with 18 additions and 1 deletions
  1. 5
    1
      src/libespeak-ng/mbrowrap.c
  2. 13
    0
      src/libespeak-ng/synth_mbrola.c

+ 5
- 1
src/libespeak-ng/mbrowrap.c View File

@@ -347,7 +347,11 @@ static int mbrola_has_errors(void)
strncmp(buf_ptr, "Input Flush Signal", 18) == 0)
continue;
*lf = 0;
fprintf(stderr, "mbrola: %s\n", buf_ptr);
if (strstr(buf_ptr, "mbrola: No such file or directory") != NULL)
fprintf(stderr,
"mbrola executable was not found. Please install MBROLA!\n");
else
fprintf(stderr, "mbrola: %s\n", buf_ptr);
// is this the last line?
if (lf == &buf_ptr[result - 1]) {
snprintf(mbr_errorbuf, sizeof(mbr_errorbuf),

+ 13
- 0
src/libespeak-ng/synth_mbrola.c View File

@@ -97,6 +97,19 @@ espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, const char *phtrans,

if (GetFileLength(path) <= 0)
sprintf(path, "/usr/share/mbrola/voices/%s", mbrola_voice);

// Show error message
if (GetFileLength(path) <= 0) {
fprintf(stderr, "Cannot find MBROLA voice file '%s' in neither of paths:\n"
" - /usr/share/mbrola/%s\n"
" - /usr/share/mbrola/%s/%s\n"
" - /usr/share/mbrola/voices/%s\n"
"Please install necessary MBROLA voice!\n",
mbrola_voice, mbrola_voice, mbrola_voice, mbrola_voice, mbrola_voice);
// Set path back to simple name, otherwise it shows misleading error only for
// last unsuccessfully searched path
sprintf(path, "%s", mbrola_voice);
}
}
}
close_MBR();

Loading…
Cancel
Save