mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-02 22:07:12 +00:00
espeak-ng: use the new espeak-ng initialization APIs
This commit is contained in:
+14
-2
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user