summaryrefslogtreecommitdiffstats
path: root/audio_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio_hw.c')
-rw-r--r--audio_hw.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/audio_hw.c b/audio_hw.c
index 38acef4..7dee074 100644
--- a/audio_hw.c
+++ b/audio_hw.c
@@ -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);