diff options
Diffstat (limited to 'audio_in.c')
-rw-r--r-- | audio_in.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -30,6 +30,7 @@ #define EFFECT_UUID_NULL EFFECT_UUID_NULL_IN #define EFFECT_UUID_NULL_STR EFFECT_UUID_NULL_STR_IN #include "audio_hw.h" +#include "mixer.h" /* * Functions @@ -100,8 +101,22 @@ static char *audio_in_get_parameters(const struct audio_stream *stream, static int audio_in_set_gain(struct audio_stream_in *stream, float gain) { + struct tinyalsa_audio_stream_in *stream_in; + LOGD("%s(%p, %f)", __func__, stream, gain); + if(stream == NULL) + return -1; + + stream_in = (struct tinyalsa_audio_stream_in *) stream; + + if(stream_in->device == NULL || stream_in->device->mixer == NULL) + return -1; + + // FIXME: Select the device + tinyalsa_mixer_set_input_gain(stream_in->device->mixer, + AUDIO_DEVICE_IN_DEFAULT, stream_in->device->mode, gain); + return 0; } @@ -168,7 +183,7 @@ int audio_hw_open_input_stream(struct audio_hw_device *dev, if(tinyalsa_audio_stream_in == NULL) return -ENOMEM; - tinyalsa_audio_stream_in->dev = tinyalsa_audio_device; + tinyalsa_audio_stream_in->device = tinyalsa_audio_device; stream = &(tinyalsa_audio_stream_in->stream); stream->common.get_sample_rate = audio_in_get_sample_rate; |