Browse Source

Support deterministic PRNG mode in CLI

master
Yury Popov 2 years ago
parent
commit
24892aae06
No account linked to committer's email address
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      src/espeak-ng.c

+ 11
- 1
src/espeak-ng.c View File

"-x\t Write phoneme mnemonics to stdout\n" "-x\t Write phoneme mnemonics to stdout\n"
"-X\t Write phonemes mnemonics and translation trace to stdout\n" "-X\t Write phonemes mnemonics and translation trace to stdout\n"
"-z\t No final sentence pause at the end of the text\n" "-z\t No final sentence pause at the end of the text\n"
"-D\t Enable deterministic random mode\n"
"--compile=<voice name>\n" "--compile=<voice name>\n"
"\t Compile pronunciation rules and dictionary from the current\n" "\t Compile pronunciation rules and dictionary from the current\n"
"\t directory. <voice name> specifies the language\n" "\t directory. <voice name> specifies the language\n"
int phoneme_options = 0; int phoneme_options = 0;
int option_linelength = 0; int option_linelength = 0;
int option_waveout = 0; int option_waveout = 0;
bool deterministic = 0;
espeak_VOICE voice_select; espeak_VOICE voice_select;
char filename[200]; char filename[200];
option_punctlist[0] = 0; option_punctlist[0] = 0;


while (true) { while (true) {
c = getopt_long(argc, argv, "a:b:d:f:g:hk:l:mp:qs:v:w:xXz", c = getopt_long(argc, argv, "a:b:Dd:f:g:hk:l:mp:qs:v:w:xXz",
long_options, &option_index); long_options, &option_index);


// Detect the end of the options. // Detect the end of the options.
case 'd': case 'd':
strncpy0(devicename, optarg2, sizeof(devicename)); strncpy0(devicename, optarg2, sizeof(devicename));
break; break;
case 'D':
deterministic = 1;
break;
case 'h': case 'h':
printf("\n"); printf("\n");
PrintVersion(); PrintVersion();
exit(1); exit(1);
} }


if (deterministic) {
// Set random generator state to well-known
espeak_ng_SetRandSeed(1);
}

if (option_waveout || quiet) { if (option_waveout || quiet) {
// writing to a file (or no output), we can use synchronous mode // writing to a file (or no output), we can use synchronous mode
result = espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, 0, devicename[0] ? devicename : NULL); result = espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, 0, devicename[0] ? devicename : NULL);

Loading…
Cancel
Save