| { 0, 0, 0, 0 } | { 0, 0, 0, 0 } | ||||
| }; | }; | ||||
| static const char *err_load = "Failed to read "; | |||||
| FILE *f_text = NULL; | FILE *f_text = NULL; | ||||
| const char *p_text = NULL; | const char *p_text = NULL; | ||||
| char *data_path = NULL; // use default path for espeak-data | char *data_path = NULL; // use default path for espeak-data | ||||
| if (voicename[0] == 0) | if (voicename[0] == 0) | ||||
| strcpy(voicename, "default"); | strcpy(voicename, "default"); | ||||
| if (espeak_SetVoiceByName(voicename) != EE_OK) { | |||||
| result = espeak_ng_SetVoiceByName(voicename); | |||||
| if (result != ENS_OK) { | |||||
| memset(&voice_select, 0, sizeof(voice_select)); | memset(&voice_select, 0, sizeof(voice_select)); | ||||
| voice_select.languages = voicename; | voice_select.languages = voicename; | ||||
| if (espeak_SetVoiceByProperties(&voice_select) != EE_OK) { | |||||
| fprintf(stderr, "%svoice '%s'\n", err_load, voicename); | |||||
| exit(2); | |||||
| result = espeak_ng_SetVoiceByProperties(&voice_select); | |||||
| if (result != ENS_OK) { | |||||
| espeak_ng_PrintStatusCodeMessage(result, stderr, NULL); | |||||
| exit(EXIT_FAILURE); | |||||
| } | } | ||||
| } | } | ||||
| if (flag_stdin == 0) | if (flag_stdin == 0) | ||||
| option_linelength = -1; // single input lines on stdin | option_linelength = -1; // single input lines on stdin | ||||
| } | } | ||||
| } else | |||||
| } else { | |||||
| f_text = fopen(filename, "r"); | f_text = fopen(filename, "r"); | ||||
| if ((f_text == NULL) && (p_text == NULL)) { | |||||
| fprintf(stderr, "%sfile '%s'\n", err_load, filename); | |||||
| exit(1); | |||||
| if (f_text == NULL) { | |||||
| fprintf(stderr, "Failed to read file '%s'\n", filename); | |||||
| exit(EXIT_FAILURE); | |||||
| } | |||||
| } | } | ||||
| if (option_waveout || quiet) { | if (option_waveout || quiet) { | ||||
| } | } | ||||
| } else if (OpenWaveFile(wavefile, samplerate) != 0) { | } else if (OpenWaveFile(wavefile, samplerate) != 0) { | ||||
| fprintf(stderr, "Can't write to output file '%s'\n'", wavefile); | fprintf(stderr, "Can't write to output file '%s'\n'", wavefile); | ||||
| exit(3); | |||||
| exit(EXIT_FAILURE); | |||||
| } | } | ||||
| } | } | ||||