diff options
author | XANTRONIX Development | 2022-02-01 22:12:56 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-02-01 22:13:35 -0500 |
commit | 325f2f18c93ede6f0de0efcc211fb856d0bfbcaa (patch) | |
tree | 3f3151cc552050fc73eb29a00a0acdf15ad4e42f | |
parent | e7746e3358b7dd8bb57e63aa67c020b598b723c6 (diff) | |
download | xas-325f2f18c93ede6f0de0efcc211fb856d0bfbcaa.tar.gz xas-325f2f18c93ede6f0de0efcc211fb856d0bfbcaa.tar.bz2 xas-325f2f18c93ede6f0de0efcc211fb856d0bfbcaa.zip |
Implement xas_vox_generate()
Implement xas_vox_generate() to finalise phrases sent to Festival
-rw-r--r-- | include/xas/vox.h | 2 | ||||
-rw-r--r-- | src/vox.c | 26 |
2 files changed, 13 insertions, 15 deletions
diff --git a/include/xas/vox.h b/include/xas/vox.h index 7eb72d1..3a940d5 100644 --- a/include/xas/vox.h +++ b/include/xas/vox.h @@ -38,6 +38,8 @@ void xas_vox_destroy(xas_vox *vox); int xas_vox_stop(xas_vox *vox); +int xas_vox_generate(xas_vox *vox); + int xas_vox_vsayf(xas_vox *vox, const char *message, va_list args); int xas_vox_sayf(xas_vox *vox, const char *message, ...); @@ -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; |