summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vox.c26
1 files changed, 11 insertions, 15 deletions
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;