espeak-ng: use the new espeak-ng initialization APIs

This commit is contained in:
Reece H. Dunn
2016-01-01 19:01:16 +00:00
parent 975ffade6c
commit b28a0001c0
3 changed files with 22 additions and 2 deletions
+14 -2
View File
@@ -579,9 +579,20 @@ int main(int argc, char **argv)
}
}
espeak_ng_InitializePath(data_path);
espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) {
if (result == ENE_READ_ERROR)
fprintf(stderr, "Failed to load espeak-data\n");
else
fprintf(stderr, "Wrong version of espeak-data\n");
exit(1);
}
if (option_waveout || quiet) {
// writing to a file (or no output), we can use synchronous mode
samplerate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 0, data_path, 0);
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, 0, NULL);
samplerate = espeak_ng_GetSampleRate();
samples_split = samplerate * samples_split_seconds;
espeak_SetSynthCallback(SynthCallback);
@@ -595,7 +606,8 @@ int main(int argc, char **argv)
}
} else {
// play the sound output
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0);
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, 0, NULL);
samplerate = espeak_ng_GetSampleRate();
}
if (voicename[0] == 0)