diff options
author | Francescodario Cuzzocrea <bosconovic@gmail.com> | 2020-04-25 15:30:31 +0200 |
---|---|---|
committer | Chih-Wei Huang <cwhuang@linux.org.tw> | 2020-04-28 13:53:48 +0800 |
commit | 6d1fe3709284532cb22c3f30cb32fd10b389d95b (patch) | |
tree | d811a5e71e366de69079903f59cbe8de08e92ec1 | |
parent | d9cfa852a34b299be1de178ef59257cf4bcc5e14 (diff) | |
download | platform_hardware_libaudio-nougat-x86.tar.gz platform_hardware_libaudio-nougat-x86.tar.bz2 platform_hardware_libaudio-nougat-x86.zip |
libaudio: add headset-mic routing supportandroid-x86-8.1-r5android-x86-7.1-r4oreo-x86nougat-x86
- this enables using headset microphone when connected
- it needs the headset-mic path declared in mixer_paths
-rw-r--r-- | audio_hw.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -258,12 +258,14 @@ static void select_devices(struct audio_device *adev) int speaker_on; int docked; int main_mic_on; + int headset_mic_on; headphone_on = adev->out_device & (AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE); speaker_on = adev->out_device & AUDIO_DEVICE_OUT_SPEAKER; docked = adev->out_device & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET; main_mic_on = adev->in_device & AUDIO_DEVICE_IN_BUILTIN_MIC; + headset_mic_on = adev->in_device & AUDIO_DEVICE_IN_WIRED_HEADSET; reset_mixer_state(adev->ar); @@ -275,11 +277,13 @@ static void select_devices(struct audio_device *adev) audio_route_apply_path(adev->ar, "dock"); if (main_mic_on) audio_route_apply_path(adev->ar, "main-mic"); + if (headset_mic_on) + audio_route_apply_path(adev->ar, "headset-mic"); update_mixer_state(adev->ar); - ALOGV("hp=%c speaker=%c dock=%c main-mic=%c", headphone_on ? 'y' : 'n', - speaker_on ? 'y' : 'n', docked ? 'y' : 'n', main_mic_on ? 'y' : 'n'); + ALOGV("hp=%c speaker=%c dock=%c main-mic=%c headset-mic=%c", headphone_on ? 'y' : 'n', + speaker_on ? 'y' : 'n', docked ? 'y' : 'n', main_mic_on ? 'y' : 'n', headset_mic_on ? 'y' : 'n'); } /* must be called with hw device and output stream mutexes locked */ |