diff options
author | XANTRONIX Development | 2022-03-17 11:33:22 -0400 |
---|---|---|
committer | XANTRONIX Development | 2022-03-17 11:33:22 -0400 |
commit | 9708b5b0e2b5de0e60fb6b0ef7925bc9375b85cf (patch) | |
tree | aef908a56c0e77660d5102ba096addb1ff514223 /src/vox.c | |
parent | c424f18c451408aa1adb146008b713eac7669b62 (diff) | |
download | xas-9708b5b0e2b5de0e60fb6b0ef7925bc9375b85cf.tar.gz xas-9708b5b0e2b5de0e60fb6b0ef7925bc9375b85cf.tar.bz2 xas-9708b5b0e2b5de0e60fb6b0ef7925bc9375b85cf.zip |
Implement xas_object_call_table
Changes:
* Implement xas_object_call_table as a static structure to allow
creating a static dispatch table on a per-compilation-unit basis
* Refactor xas_object to provide a single pointer to a
xas_object_call_table
* Refactor all object implementations to use xas_object_call_table
Diffstat (limited to 'src/vox.c')
-rw-r--r-- | src/vox.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -277,6 +277,14 @@ static int vox_generate(xas_vox *vox, ...) { return xas_vox_generate(vox); } +static xas_object_call_table call_table = { + .start = (xas_object_start_callback)vox_generate, + .stop = (xas_object_stop_callback)vox_stop, + .set_gain = (xas_object_set_gain_callback)set_gain, + .stream_new = (xas_object_stream_new_callback)xas_vox_stream_new, + .destroy = (xas_object_destroy_callback)xas_vox_destroy +}; + xas_vox *xas_vox_new_args(xas_audio_format format, size_t buffer_size, const char *text2wave_path, @@ -288,11 +296,7 @@ xas_vox *xas_vox_new_args(xas_audio_format format, goto error_malloc_vox; } - vox->obj.start = (xas_object_start_callback)vox_generate; - vox->obj.stop = (xas_object_stop_callback)vox_stop; - vox->obj.set_gain = (xas_object_set_gain_callback)set_gain; - vox->obj.stream_new = (xas_object_stream_new_callback)xas_vox_stream_new; - vox->obj.destroy = (xas_object_destroy_callback)xas_vox_destroy; + vox->obj.table = &call_table; vox->text2wave_path = text2wave_path; |