diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-10-26 15:47:01 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2012-10-26 15:47:01 +0200 |
commit | f6e1b0eae63dfd937213e0b0fdb01f106621421c (patch) | |
tree | 8c8b018a2461c7096f203f0ea6ba091fda1ab22c /audio_hw.c | |
parent | 7751e9ab8b411d69fab1e455ef4ff75b883ab4d6 (diff) | |
download | hardware_tinyalsa-audio-f6e1b0eae63dfd937213e0b0fdb01f106621421c.zip hardware_tinyalsa-audio-f6e1b0eae63dfd937213e0b0fdb01f106621421c.tar.gz hardware_tinyalsa-audio-f6e1b0eae63dfd937213e0b0fdb01f106621421c.tar.bz2 |
Mixer: Avoid mode and use directions logic instead, introducing modem support
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'audio_hw.c')
-rw-r--r-- | audio_hw.c | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -89,7 +89,7 @@ static int audio_hw_set_voice_volume(struct audio_hw_device *dev, float volume) if(device->mode == AUDIO_MODE_IN_CALL) { // FIXME: Select the device from ril interface tinyalsa_mixer_set_voice_volume(device->mixer, - AUDIO_DEVICE_IN_DEFAULT, device->mode, volume); + AUDIO_DEVICE_OUT_DEFAULT, volume); } return 0; @@ -126,16 +126,17 @@ static int audio_hw_set_mode(struct audio_hw_device *dev, int mode) device = (struct tinyalsa_audio_device *) dev; if(mode != device->mode) { - device->mode = mode; + if(mode == AUDIO_MODE_IN_CALL) { + tinyalsa_mixer_set_modem_state(device->mixer, 1); - if(device->stream_out != NULL) { - audio_out_set_route(device->stream_out, - device->stream_out->device_current); - // TODO: audio_input_set_route + if(device->stream_out != NULL) + tinyalsa_mixer_set_device(device->mixer, device->stream_out->device_current); + } else if(device->mode == AUDIO_MODE_IN_CALL) { + tinyalsa_mixer_set_modem_state(device->mixer, 0); } - } - device->mode = mode; + device->mode = mode; + } return 0; } @@ -160,7 +161,7 @@ static int audio_hw_set_mic_mute(struct audio_hw_device *dev, bool state) // FIXME: Select the device from input if mode isn't in-call, // select it from ril interface if mode is in-call tinyalsa_mixer_set_mic_mute(device->mixer, - AUDIO_DEVICE_IN_DEFAULT, device->mode, state); + AUDIO_DEVICE_IN_DEFAULT, state); } return 0; @@ -307,11 +308,6 @@ int audio_hw_open(const hw_module_t *module, const char *name, goto error_device; } - rc = tinyalsa_mixer_set_route(tinyalsa_mixer, AUDIO_DEVICE_OUT_DEFAULT, AUDIO_MODE_NORMAL); - if(rc < 0) { - LOGE("Failed to set default mixer route"); - } - tinyalsa_audio_device->mixer = tinyalsa_mixer; *device = &(dev->common); |