mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-06 07:03:12 +00:00
Generate build errors if phoneme or language data files contain errors.
This commit is contained in:
+2
-2
@@ -656,8 +656,8 @@ no) ë (_ e // canoë
|
||||
ai) gni n^ // craignions châtaignier
|
||||
gn nj // agneau
|
||||
_wa) gner (_ gnEr
|
||||
_sta) gn ( gn
|
||||
dia) gn ( gn
|
||||
_sta) gn gn
|
||||
dia) gn gn
|
||||
_) gn (om gn
|
||||
_) gn (ou_ gn
|
||||
gn (osie_ gn
|
||||
|
||||
+5
-8
@@ -568,16 +568,13 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 0x10e: // --compile-mbrola
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0);
|
||||
espeak_ng_CompileMbrolaVoice(optarg2, stdout);
|
||||
exit(0);
|
||||
return (espeak_ng_CompileMbrolaVoice(optarg2, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
case 0x10f: // --compile-intonations
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY);
|
||||
espeak_ng_CompileIntonation(stdout);
|
||||
exit(0);
|
||||
return (espeak_ng_CompileIntonation(stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
case 0x110: // --compile-phonemes
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY);
|
||||
espeak_ng_CompilePhonemeData(22050, stdout);
|
||||
exit(0);
|
||||
return (espeak_ng_CompilePhonemeData(22050, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
@@ -616,8 +613,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if (flag_compile) {
|
||||
// This must be done after the voice is set
|
||||
espeak_CompileDictionary("", stderr, flag_compile & 0x1);
|
||||
exit(0);
|
||||
return (espeak_ng_CompileDictionary("", NULL, stderr, flag_compile & 0x1) == ENS_OK)
|
||||
? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// set any non-default values of parameters. This must be done after espeak_Initialize()
|
||||
|
||||
@@ -46,10 +46,18 @@ typedef enum {
|
||||
#define espeakINITIALIZE_PATH_ONLY 0x4000
|
||||
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_CompileMbrolaVoice(const char *path, FILE *log);
|
||||
espeak_ng_CompileDictionary(const char *dsource,
|
||||
const char *dict_name,
|
||||
FILE *log,
|
||||
int flags);
|
||||
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_CompilePhonemeData(long rate, FILE *log);
|
||||
espeak_ng_CompileMbrolaVoice(const char *path,
|
||||
FILE *log);
|
||||
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_CompilePhonemeData(long rate,
|
||||
FILE *log);
|
||||
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_CompileIntonation(FILE *log);
|
||||
|
||||
@@ -2926,7 +2926,7 @@ static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
|
||||
fclose(f_errors);
|
||||
|
||||
ReadPhondataManifest();
|
||||
return ENS_OK;
|
||||
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK;
|
||||
}
|
||||
|
||||
static const char *preset_tune_names[] = {
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include "espeak_ng.h"
|
||||
#include "speak_lib.h"
|
||||
|
||||
#include "speech.h"
|
||||
#include "phoneme.h"
|
||||
#include "synthesize.h"
|
||||
@@ -1510,8 +1512,12 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *fname_err, int flags)
|
||||
#pragma GCC visibility push(default)
|
||||
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_CompileDictionary(const char *dsource, const char *dict_name, FILE *log, int flags)
|
||||
{
|
||||
if (!log) log = stderr;
|
||||
if (!dict_name) dict_name = dictionary_name;
|
||||
|
||||
// fname: space to write the filename in case of error
|
||||
// flags: bit 0: include source line number information, for debug purposes.
|
||||
|
||||
@@ -1542,19 +1548,14 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
|
||||
sprintf(fname_in, "%srules.txt", path);
|
||||
if ((f_in = fopen(fname_in, "r")) == NULL) {
|
||||
sprintf(fname_in, "%srules", path);
|
||||
if ((f_in = fopen_log(fname_in, "r")) == NULL) {
|
||||
if (fname_err)
|
||||
strcpy(fname_err, fname_in);
|
||||
return -1;
|
||||
}
|
||||
if ((f_in = fopen_log(fname_in, "r")) == NULL)
|
||||
return ENE_READ_ERROR;
|
||||
}
|
||||
|
||||
sprintf(fname_out, "%s%c%s_dict", path_home, PATHSEP, dict_name);
|
||||
if ((f_out = fopen_log(fname_out, "wb+")) == NULL) {
|
||||
if (fname_err)
|
||||
strcpy(fname_err, fname_out);
|
||||
fclose(f_in);
|
||||
return -1;
|
||||
return ENE_WRITE_ERROR;
|
||||
}
|
||||
sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP);
|
||||
|
||||
@@ -1590,5 +1591,6 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
|
||||
|
||||
LoadDictionary(translator, dict_name, 0);
|
||||
|
||||
return error_count;
|
||||
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK;
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
@@ -63,6 +63,8 @@ static unsigned int StringToWord(const char *string)
|
||||
#pragma GCC visibility push(default)
|
||||
espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log)
|
||||
{
|
||||
if (!log) log = stderr;
|
||||
|
||||
char *p;
|
||||
FILE *f_in;
|
||||
FILE *f_out;
|
||||
|
||||
@@ -901,7 +901,7 @@ ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode,
|
||||
|
||||
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags)
|
||||
{
|
||||
CompileDictionary(path, dictionary_name, log, NULL, flags);
|
||||
espeak_ng_CompileDictionary(path, dictionary_name, log, flags);
|
||||
}
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Cancel(void)
|
||||
|
||||
@@ -515,7 +515,6 @@ int SelectPhonemeTableName(const char *name);
|
||||
void Write4Bytes(FILE *f, int value);
|
||||
int Read4Bytes(FILE *f);
|
||||
int Reverse4Bytes(int word);
|
||||
int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *err_name, int flags);
|
||||
|
||||
#define ENV_LEN 128 // length of pitch envelopes
|
||||
#define PITCHfall 0 // standard pitch envelopes
|
||||
|
||||
+7
-10
@@ -648,16 +648,13 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 0x10e: // --compile-mbrola
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0);
|
||||
espeak_ng_CompileMbrolaVoice(optarg2, stdout);
|
||||
exit(0);
|
||||
return (espeak_ng_CompileMbrolaVoice(optarg2, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
case 0x10f: // --compile-intonations
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY);
|
||||
espeak_ng_CompileIntonation(stdout);
|
||||
exit(0);
|
||||
return (espeak_ng_CompileIntonation(stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
case 0x110: // --compile-phonemes
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY);
|
||||
espeak_ng_CompilePhonemeData(22050, stdout);
|
||||
exit(0);
|
||||
return (espeak_ng_CompilePhonemeData(22050, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
@@ -684,19 +681,19 @@ int main(int argc, char **argv)
|
||||
strcpy(path_dsource, path_home);
|
||||
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end
|
||||
strcat(path_dsource, "dictsource\\");
|
||||
CompileDictionary(path_dsource, dictionary_name, NULL, NULL, flag_compile & 0x1);
|
||||
espeak_ng_STATUS status = espeak_ng_CompileDictionary(path_dsource, dictionary_name, NULL, flag_compile & 0x1);
|
||||
#else
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
char path_dsource[sizeof(path_home)+20];
|
||||
strcpy(path_dsource, path_home);
|
||||
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end
|
||||
strcat(path_dsource, "dictsource\\");
|
||||
CompileDictionary(path_dsource, dictionary_name, NULL, NULL, flag_compile & 0x1);
|
||||
espeak_ng_STATUS status = espeak_ng_CompileDictionary(path_dsource, dictionary_name, NULL, flag_compile & 0x1);
|
||||
#else
|
||||
CompileDictionary(NULL, dictionary_name, NULL, NULL, flag_compile & 0x1);
|
||||
espeak_ng_STATUS status = espeak_ng_CompileDictionary(NULL, dictionary_name, NULL, flag_compile & 0x1);
|
||||
#endif
|
||||
#endif
|
||||
exit(0);
|
||||
return (status == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SetParameter(espeakRATE, speed, 0);
|
||||
|
||||
Reference in New Issue
Block a user