|
|
|
|
|
|
|
|
#include "wx/progdlg.h" |
|
|
#include "wx/progdlg.h" |
|
|
|
|
|
|
|
|
#include "speak_lib.h" |
|
|
#include "speak_lib.h" |
|
|
|
|
|
#include "espeak_ng.h" |
|
|
|
|
|
|
|
|
#include "speech.h" |
|
|
#include "speech.h" |
|
|
#include "phoneme.h" |
|
|
#include "phoneme.h" |
|
|
#include "synthesize.h" |
|
|
#include "synthesize.h" |
|
|
|
|
|
|
|
|
extern char voice_name2[40]; |
|
|
extern char voice_name2[40]; |
|
|
|
|
|
|
|
|
extern void FindPhonemesUsed(void); |
|
|
extern void FindPhonemesUsed(void); |
|
|
extern void DisplayErrorFile(const char *fname); |
|
|
|
|
|
extern "C" int utf8_in(int *c, const char *buf); |
|
|
extern "C" int utf8_in(int *c, const char *buf); |
|
|
extern "C" int utf8_out(unsigned int c, char *buf); |
|
|
extern "C" int utf8_out(unsigned int c, char *buf); |
|
|
extern void DrawEnvelopes(); |
|
|
extern void DrawEnvelopes(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CompileIntonation() |
|
|
|
|
|
|
|
|
espeak_ng_STATUS CompileIntonation(FILE *log) |
|
|
{//===================== |
|
|
{//===================== |
|
|
int ix; |
|
|
int ix; |
|
|
char *p; |
|
|
char *p; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char name[12]; |
|
|
char name[12]; |
|
|
char fname_errors[sizeof(path_source)+120]; |
|
|
|
|
|
char tune_names[N_TUNE_NAMES][12]; |
|
|
char tune_names[N_TUNE_NAMES][12]; |
|
|
char buf[sizeof(path_source)+120]; |
|
|
char buf[sizeof(path_source)+120]; |
|
|
|
|
|
|
|
|
error_count = 0; |
|
|
error_count = 0; |
|
|
|
|
|
|
|
|
sprintf(fname_errors,"%s%s",path_source,"error_intonation"); |
|
|
|
|
|
if((f_errors = fopen(fname_errors,"w")) == NULL) |
|
|
|
|
|
f_errors = stderr; |
|
|
|
|
|
|
|
|
f_errors = log; |
|
|
|
|
|
|
|
|
sprintf(buf,"%sintonation.txt",path_source); |
|
|
sprintf(buf,"%sintonation.txt",path_source); |
|
|
if((f_in = fopen(buf, "r")) == NULL) |
|
|
if((f_in = fopen(buf, "r")) == NULL) |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
wxLogError(_T("Can't read file: ") + wxString(buf,wxConvLocal)); |
|
|
wxLogError(_T("Can't read file: ") + wxString(buf,wxConvLocal)); |
|
|
fclose(f_errors); |
|
|
fclose(f_errors); |
|
|
return; |
|
|
|
|
|
|
|
|
return ENE_READ_ERROR; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(f_errors, "Failed to allocate data for tunes\n"); |
|
|
fprintf(f_errors, "Failed to allocate data for tunes\n"); |
|
|
fclose(f_in); |
|
|
fclose(f_in); |
|
|
fclose(f_errors); |
|
|
fclose(f_errors); |
|
|
return; |
|
|
|
|
|
|
|
|
return ENE_OUT_OF_MEMORY; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sprintf(buf,"%s/intonations",path_home); |
|
|
sprintf(buf,"%s/intonations",path_home); |
|
|
|
|
|
|
|
|
fclose(f_in); |
|
|
fclose(f_in); |
|
|
fclose(f_errors); |
|
|
fclose(f_errors); |
|
|
free(tune_data); |
|
|
free(tune_data); |
|
|
return; |
|
|
|
|
|
|
|
|
return ENE_WRITE_ERROR; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
while(!feof(f_in)) |
|
|
while(!feof(f_in)) |
|
|
|
|
|
|
|
|
report.Printf(_T("Compiled %d intonation tunes: %d errors."),n_tune_names, error_count); |
|
|
report.Printf(_T("Compiled %d intonation tunes: %d errors."),n_tune_names, error_count); |
|
|
wxLogStatus(report); |
|
|
wxLogStatus(report); |
|
|
|
|
|
|
|
|
if(error_count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
DisplayErrorFile(fname_errors); |
|
|
|
|
|
} |
|
|
|
|
|
LoadPhData(NULL); |
|
|
LoadPhData(NULL); |
|
|
|
|
|
|
|
|
|
|
|
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK; |
|
|
} // end of CompileIntonation |
|
|
} // end of CompileIntonation |
|
|
|
|
|
|
|
|
|
|
|
|