summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mixer.c25
1 files changed, 25 insertions, 0 deletions
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;