From 06e6fa5bf0d8fd714adca83703435e2274ba8698 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Sat, 19 Mar 2022 12:25:36 -0400 Subject: Use larger default vox buffer size of 20480 Use larger default vox buffer size of 20480 to improve performance and reduce number of read()/write() system calls --- examples/say.c | 1 - examples/spatial.c | 1 - include/xas/drone.h | 1 - include/xas/vox.h | 5 ++--- src/drone.c | 1 - src/spatial.c | 1 - src/vox.c | 5 +---- 7 files changed, 3 insertions(+), 12 deletions(-) diff --git a/examples/say.c b/examples/say.c index 115c78f..2cc8982 100644 --- a/examples/say.c +++ b/examples/say.c @@ -84,7 +84,6 @@ int main(int argc, char **argv) { } if ((vox = xas_vox_new(format, - buffer_size, "/usr/bin/text2wave")) == NULL) { goto error_vox_new; } diff --git a/examples/spatial.c b/examples/spatial.c index 183100a..39b6514 100644 --- a/examples/spatial.c +++ b/examples/spatial.c @@ -77,7 +77,6 @@ int main(int argc, char **argv) { } if ((vox = xas_vox_new(format, - buffer_size, "/usr/bin/text2wave")) == NULL) { goto error_vox_new; } diff --git a/include/xas/drone.h b/include/xas/drone.h index df16040..a7a2d4f 100644 --- a/include/xas/drone.h +++ b/include/xas/drone.h @@ -9,7 +9,6 @@ #include #include -#define XAS_DRONE_VOX_BUFFER_SIZE 735 #define XAS_DRONE_VOX_TEXT2WAVE_PATH "/usr/bin/text2wave" #define XAS_DRONE_CHAMBER_BASS_FREQUENCY 20 /* Hz */ diff --git a/include/xas/vox.h b/include/xas/vox.h index b3ea0ed..71a312d 100644 --- a/include/xas/vox.h +++ b/include/xas/vox.h @@ -8,7 +8,8 @@ #include #include -#define XAS_VOX_DEFAULT_GAIN 1.0f +#define XAS_VOX_DEFAULT_GAIN 1.0f +#define XAS_VOX_DEFAULT_BUFFER_SIZE 20480 #define XAS_VOX_SETTINGS_TMP_PATH "/tmp/xas-vox.XXXXXX" #define XAS_VOX_SETTINGS_TMP_PATHLEN 64 @@ -44,13 +45,11 @@ typedef struct _xas_vox { } xas_vox; xas_vox *xas_vox_new_args(xas_audio_format format, - size_t buffer_size, const char *text2wave_path, int argn, char **args); xas_vox *xas_vox_new(xas_audio_format format, - size_t buffer_size, const char *text2wave_path); void xas_vox_destroy(xas_vox *vox); diff --git a/src/drone.c b/src/drone.c index 4fa9ddb..1fc8424 100644 --- a/src/drone.c +++ b/src/drone.c @@ -94,7 +94,6 @@ xas_drone *xas_drone_new(xas_spatial_scene *scene, } if ((drone->vox = xas_vox_new(scene->format, - XAS_DRONE_VOX_BUFFER_SIZE, XAS_DRONE_VOX_TEXT2WAVE_PATH)) == NULL) { goto error_vox_new; } diff --git a/src/spatial.c b/src/spatial.c index afbcbb7..5978293 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -586,7 +586,6 @@ xas_spatial_object *xas_spatial_scene_add_vox(xas_spatial_scene *scene, xas_audio_stream *stream; if ((vox = xas_vox_new(scene->format, - scene->buffer->size, text2wave_path)) == NULL) { goto error_vox_new; } diff --git a/src/vox.c b/src/vox.c index 8628288..100ef46 100644 --- a/src/vox.c +++ b/src/vox.c @@ -286,7 +286,6 @@ static xas_object_call_table call_table = { }; xas_vox *xas_vox_new_args(xas_audio_format format, - size_t buffer_size, const char *text2wave_path, int argn, char **args) { @@ -304,7 +303,7 @@ 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 = buffer_size; + vox->buffer_size = XAS_VOX_DEFAULT_BUFFER_SIZE; vox->gain = XAS_VOX_DEFAULT_GAIN; vox->state = XAS_VOX_IDLE; vox->pid = -1; @@ -326,10 +325,8 @@ error_malloc_vox: } xas_vox *xas_vox_new(xas_audio_format format, - size_t buffer_size, const char *text2wave_path) { return xas_vox_new_args(format, - buffer_size, text2wave_path, 0, NULL); -- cgit v1.2.3