summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xas/vox.h2
-rw-r--r--src/vox.c26
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, ...);
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;