From 325f2f18c93ede6f0de0efcc211fb856d0bfbcaa Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 1 Feb 2022 22:12:56 -0500 Subject: Implement xas_vox_generate() Implement xas_vox_generate() to finalise phrases sent to Festival --- src/vox.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/vox.c b/src/vox.c index 6c4551e..e1802fa 100644 --- a/src/vox.c +++ b/src/vox.c @@ -211,18 +211,9 @@ int xas_vox_stop(xas_vox *vox) { return vox_stop(vox); } -int xas_vox_vsayf(xas_vox *vox, const char *format, va_list args) { - int ret; +int xas_vox_generate(xas_vox *vox) { xas_audio_stream *output; - if (vox_start(vox) < 0) { - goto error_vox_start; - } - - if ((ret = vfprintf(vox->in, format, args)) < 0) { - goto error_vfprintf; - } - (void)fflush(vox->in); (void)fclose(vox->in); (void)close(vox->stdin); @@ -243,14 +234,19 @@ int xas_vox_vsayf(xas_vox *vox, const char *format, va_list args) { xas_audio_stream_destroy(output); - return ret; + return 0; error_invalid_stream: - xas_audio_stream_destroy(output); - error_riff_open_fd: -error_vfprintf: - (void)vox_stop(vox); + return -1; +} + +int xas_vox_vsayf(xas_vox *vox, const char *format, va_list args) { + if (vox_start(vox) < 0) { + goto error_vox_start; + } + + return vfprintf(vox->in, format, args); error_vox_start: return -1; -- cgit v1.2.3