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)
+3
View File
@@ -60,6 +60,9 @@ espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE output_mode,
int buffer_length,
const char *device);
ESPEAK_NG_API int
espeak_ng_GetSampleRate(void);
ESPEAK_NG_API espeak_ng_STATUS
espeak_ng_CompileDictionary(const char *dsource,
const char *dict_name,
+5
View File
@@ -356,6 +356,11 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Initialize(void)
return ENS_OK;
}
ESPEAK_NG_API int espeak_ng_GetSampleRate(void)
{
return samplerate;
}
#pragma GCC visibility pop
static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text, int flags)