mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-04 23:56:14 +00:00
First part of the patch: add option --load
Option --load makes espeak-ng consider the voice name provided a name of a file relative to the current directory. Signed-off-by: golubovsky <golubovsky@gmail.com>
This commit is contained in:
+19
-2
@@ -113,6 +113,10 @@ static const char *help_text =
|
||||
"--voices=<language>\n"
|
||||
"\t List the available voices for the specified language.\n"
|
||||
"\t If <language> is omitted, then list all voices.\n"
|
||||
"--load Load voice from a file in current directory by name.\n"
|
||||
"--dump=<file>\n"
|
||||
"\t Dump the currently loaded voice definition into a file\n"
|
||||
"\t in the current directory\n"
|
||||
"-h, --help Show this help.\n";
|
||||
|
||||
int samplerate;
|
||||
@@ -321,6 +325,8 @@ int main(int argc, char **argv)
|
||||
{ "compile-mbrola", optional_argument, 0, 0x10e },
|
||||
{ "compile-intonations", no_argument, 0, 0x10f },
|
||||
{ "compile-phonemes", optional_argument, 0, 0x110 },
|
||||
{ "load", no_argument, 0, 0x111 },
|
||||
{ "dump", required_argument, 0, 0x112 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -336,6 +342,7 @@ int main(int argc, char **argv)
|
||||
int value;
|
||||
int flag_stdin = 0;
|
||||
int flag_compile = 0;
|
||||
int flag_load = 0;
|
||||
int filesize = 0;
|
||||
int synth_flags = espeakCHARS_AUTO | espeakPHONEMES | espeakENDPAUSE;
|
||||
|
||||
@@ -349,8 +356,9 @@ int main(int argc, char **argv)
|
||||
int phoneme_options = 0;
|
||||
int option_linelength = 0;
|
||||
int option_waveout = 0;
|
||||
|
||||
|
||||
espeak_VOICE voice_select;
|
||||
char dumpfile[200];
|
||||
char filename[200];
|
||||
char voicename[40];
|
||||
char devicename[200];
|
||||
@@ -562,6 +570,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
case 0x111: // --load
|
||||
flag_load = 1;
|
||||
break;
|
||||
case 0x112: // --dump
|
||||
strncpy(dumpfile, optarg2, sizeof(dumpfile) - 1);
|
||||
break;
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
@@ -605,7 +619,10 @@ int main(int argc, char **argv)
|
||||
if (voicename[0] == 0)
|
||||
strcpy(voicename, ESPEAKNG_DEFAULT_VOICE);
|
||||
|
||||
result = espeak_ng_SetVoiceByName(voicename);
|
||||
if(flag_load)
|
||||
result = espeak_ng_SetVoiceByFile(voicename);
|
||||
else
|
||||
result = espeak_ng_SetVoiceByName(voicename);
|
||||
if (result != ENS_OK) {
|
||||
memset(&voice_select, 0, sizeof(voice_select));
|
||||
voice_select.languages = voicename;
|
||||
|
||||
Reference in New Issue
Block a user