diff options
author | XANTRONIX Development | 2022-03-15 18:47:08 -0400 |
---|---|---|
committer | XANTRONIX Development | 2022-03-15 18:47:08 -0400 |
commit | ed12dddb60fe4b7a4d16274dd5fc3d12a1f5ebf0 (patch) | |
tree | fb89ca2d5b2fd5a621c1b165a7b7235021904d8d | |
parent | 7f4b113f8dd3b42016a4c9b9efa3ea3b2ea3fce9 (diff) | |
download | xas-ed12dddb60fe4b7a4d16274dd5fc3d12a1f5ebf0.tar.gz xas-ed12dddb60fe4b7a4d16274dd5fc3d12a1f5ebf0.tar.bz2 xas-ed12dddb60fe4b7a4d16274dd5fc3d12a1f5ebf0.zip |
Add xas_object call table to mixer
-rw-r--r-- | include/xas/mixer.h | 1 | ||||
-rw-r--r-- | src/mixer.c | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/include/xas/mixer.h b/include/xas/mixer.h index 79d6ffb..3cf8067 100644 --- a/include/xas/mixer.h +++ b/include/xas/mixer.h @@ -21,6 +21,7 @@ typedef struct _xas_mixer_input { } xas_mixer_input; typedef struct _xas_mixer { + xas_object obj; xas_mixer_input *inputs, *last; 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; |