summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xas/mixer.h1
-rw-r--r--src/mixer.c25
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;