summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mixer.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mixer.c b/src/mixer.c
index 001c765..0f3b5b1 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -10,50 +10,54 @@
static void mixer_apply_mono_to_mono(int16_t *dest,
int16_t *src,
size_t count,
+ float gain,
float bias_l,
float bias_r) {
size_t i;
for (i=0; i<count; i++) {
- dest[i] += src[i];
+ dest[i] += gain * src[i];
}
}
static void mixer_apply_mono_to_stereo(int16_t *dest,
int16_t *src,
size_t count,
+ float gain,
float bias_l,
float bias_r) {
size_t i;
for (i=0; i<count; i++) {
- dest[i*2] += bias_l * src[i];
- dest[i*2+1] += bias_r * src[i];
+ dest[i*2] += gain * bias_l * src[i];
+ dest[i*2+1] += gain * bias_r * src[i];
}
}
static void mixer_apply_stereo_to_stereo(int16_t *dest,
int16_t *src,
size_t count,
+ float gain,
float bias_l,
float bias_r) {
size_t i;
for (i=0; i<count; i++) {
- dest[i*2] += bias_l * src[i*2];
- dest[i*2+1] += bias_r * src[i*2+1];
+ dest[i*2] += gain * bias_l * src[i*2];
+ dest[i*2+1] += gain * bias_r * src[i*2+1];
}
}
static void mixer_apply_stereo_to_mono(int16_t *dest,
int16_t *src,
size_t count,
+ float gain,
float bias_l,
float bias_r) {
size_t i;
for (i=0; i<count; i++) {
- dest[i] += (src[i*2] + src[i*2+1]) / 2;
+ dest[i] += gain * ((src[i*2] + src[i*2+1]) / 2);
}
}
@@ -74,6 +78,7 @@ static ssize_t mixer_fill(xas_mixer *mixer,
int16_t *,
size_t,
float,
+ float,
float);
xas_mixer_input *next = input->next;
@@ -102,6 +107,7 @@ static ssize_t mixer_fill(xas_mixer *mixer,
mixer_apply((int16_t *)(mixer->buf),
buf,
readlen,
+ input->gain,
input->bias_l,
input->bias_r);