summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xas/vox.h6
-rw-r--r--src/vox.c18
2 files changed, 12 insertions, 12 deletions
diff --git a/include/xas/vox.h b/include/xas/vox.h
index 71a312d..014659d 100644
--- a/include/xas/vox.h
+++ b/include/xas/vox.h
@@ -8,8 +8,8 @@
#include <xas/object.h>
#include <xas/audio.h>
-#define XAS_VOX_DEFAULT_GAIN 1.0f
-#define XAS_VOX_DEFAULT_BUFFER_SIZE 20480
+#define XAS_VOX_DEFAULT_GAIN 1.0f
+#define XAS_VOX_DEFAULT_BLKSIZE 20480
#define XAS_VOX_SETTINGS_TMP_PATH "/tmp/xas-vox.XXXXXX"
#define XAS_VOX_SETTINGS_TMP_PATHLEN 64
@@ -21,9 +21,7 @@ enum xas_vox_state {
typedef struct _xas_vox {
xas_object obj;
-
xas_audio_format format;
- size_t buffer_size;
float gain;
diff --git a/src/vox.c b/src/vox.c
index 100ef46..a5df524 100644
--- a/src/vox.c
+++ b/src/vox.c
@@ -303,13 +303,12 @@ xas_vox *xas_vox_new_args(xas_audio_format format,
vox->format.sample_size = format.sample_size;
vox->format.sample_rate = format.sample_rate;
- vox->buffer_size = XAS_VOX_DEFAULT_BUFFER_SIZE;
- vox->gain = XAS_VOX_DEFAULT_GAIN;
- vox->state = XAS_VOX_IDLE;
- vox->pid = -1;
- vox->stdin = -1;
- vox->stdout = -1;
- vox->in = NULL;
+ vox->gain = XAS_VOX_DEFAULT_GAIN;
+ vox->state = XAS_VOX_IDLE;
+ vox->pid = -1;
+ vox->stdin = -1;
+ vox->stdout = -1;
+ vox->in = NULL;
vox->argn = argn;
vox->args = args;
@@ -483,9 +482,12 @@ int xas_vox_say(xas_vox *vox, const char *message) {
}
xas_audio_stream *xas_vox_stream_new(xas_vox *vox) {
+ size_t buffer_size = XAS_VOX_DEFAULT_BLKSIZE / vox->format.sample_size
+ / vox->format.channels;
+
return xas_audio_stream_new_source((xas_audio_fill)vox_fill,
(xas_audio_cleanup)vox_cleanup,
vox->format,
- vox->buffer_size,
+ buffer_size,
vox);
}