From ed12dddb60fe4b7a4d16274dd5fc3d12a1f5ebf0 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 15 Mar 2022 18:47:08 -0400 Subject: Add xas_object call table to mixer --- src/mixer.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/mixer.c b/src/mixer.c index a60118d..60233de 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -133,6 +133,25 @@ error_audio_read_stream: return -1; } +/* TODO: Implement a single output gain, don't adjust gain on all inputs */ +static int set_gain(xas_mixer *mixer, float gain) { + xas_mixer_input *input = mixer->inputs; + + while (input) { + xas_mixer_input *next = input->next; + + xas_mixer_input_set_gain(input, gain); + + input = next; + } + + return 0; +} + +static int noop(xas_mixer *mixer) { + return 0; +} + xas_mixer *xas_mixer_new(xas_audio_format format, size_t buffer_size) { xas_mixer *mixer; @@ -154,6 +173,12 @@ xas_mixer *xas_mixer_new(xas_audio_format format, size_t buffer_size) { goto error_audio_stream_new_source; } + mixer->obj.start = (xas_object_start_callback)noop; + mixer->obj.stop = (xas_object_stop_callback)noop; + mixer->obj.set_gain = (xas_object_set_gain_callback)set_gain; + mixer->obj.stream_new = (xas_object_stream_new_callback)xas_mixer_output; + mixer->obj.destroy = (xas_object_destroy_callback)xas_mixer_destroy; + mixer->inputs = NULL; mixer->last = NULL; mixer->buffer_size = buffer_size; -- cgit v1.2.3