diff options
author | XANTRONIX Development | 2022-03-19 16:22:53 -0400 |
---|---|---|
committer | XANTRONIX Development | 2022-03-19 16:22:53 -0400 |
commit | 94473725d958e91a97bba36b3133790b8f15d715 (patch) | |
tree | e97081c5b845832110c7b2bf909a7ed1004da210 /src | |
parent | 06e6fa5bf0d8fd714adca83703435e2274ba8698 (diff) | |
download | xas-94473725d958e91a97bba36b3133790b8f15d715.tar.gz xas-94473725d958e91a97bba36b3133790b8f15d715.tar.bz2 xas-94473725d958e91a97bba36b3133790b8f15d715.zip |
Calculate vox buffer size when creating stream
Diffstat (limited to 'src')
-rw-r--r-- | src/vox.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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); } |