diff options
-rw-r--r-- | audio/hal/audio_hw.c | 39 | ||||
-rw-r--r-- | audio/hal/audio_hw.h | 4 | ||||
-rw-r--r-- | mixer_paths_0.xml | 4 |
3 files changed, 32 insertions, 15 deletions
diff --git a/audio/hal/audio_hw.c b/audio/hal/audio_hw.c index 4273dc1..2557619 100644 --- a/audio/hal/audio_hw.c +++ b/audio/hal/audio_hw.c @@ -50,7 +50,7 @@ #define MIXER_CTL_COMPRESS_PLAYBACK_VOLUME "Compress Playback Volume" /* TODO: the following PCM device profiles could be read from a config file */ -struct pcm_device_profile pcm_device_playback = { +struct pcm_device_profile pcm_device_playback_hs = { .config = { .channels = PLAYBACK_DEFAULT_CHANNEL_COUNT, .rate = PLAYBACK_DEFAULT_SAMPLING_RATE, @@ -63,10 +63,9 @@ struct pcm_device_profile pcm_device_playback = { .avail_min = PLAYBACK_AVAILABLE_MIN, }, .card = SOUND_CARD, - .id = 9, + .id = 0, .type = PCM_PLAYBACK, - .devices = AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE| - AUDIO_DEVICE_OUT_SPEAKER, + .devices = AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE, }; struct pcm_device_profile pcm_device_capture = { @@ -105,6 +104,24 @@ struct pcm_device_profile pcm_device_capture_loopback_aec = { .devices = SND_DEVICE_IN_LOOPBACK_AEC, }; +struct pcm_device_profile pcm_device_playback_spk = { + .config = { + .channels = PLAYBACK_DEFAULT_CHANNEL_COUNT, + .rate = PLAYBACK_DEFAULT_SAMPLING_RATE, + .period_size = PLAYBACK_PERIOD_SIZE, + .period_count = PLAYBACK_PERIOD_COUNT, + .format = PCM_FORMAT_S16_LE, + .start_threshold = PLAYBACK_START_THRESHOLD, + .stop_threshold = PLAYBACK_STOP_THRESHOLD, + .silence_threshold = 0, + .avail_min = PLAYBACK_AVAILABLE_MIN, + }, + .card = SOUND_CARD, + .id = 1, + .type = PCM_PLAYBACK, + .devices = AUDIO_DEVICE_OUT_SPEAKER, +}; + struct pcm_device_profile pcm_device_playback_sco = { .config = { .channels = SCO_DEFAULT_CHANNEL_COUNT, @@ -162,8 +179,9 @@ struct pcm_device_profile pcm_device_hotword_streaming = { }; struct pcm_device_profile *pcm_devices[] = { - &pcm_device_playback, + &pcm_device_playback_hs, &pcm_device_capture, + &pcm_device_playback_spk, &pcm_device_playback_sco, &pcm_device_capture_sco, &pcm_device_capture_loopback_aec, @@ -4314,7 +4332,13 @@ static void *dummybuf_thread(void *context) struct pcm_device_profile *profile = NULL; memset(&config, 0, sizeof(struct pcm_config)); - profile = &pcm_device_playback; + if (adev->dummybuf_thread_devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE) { + profile = &pcm_device_playback_hs; + mixer = mixer_open(profile->card); + } + else + profile = &pcm_device_playback_spk; + memcpy(&config, &profile->config, sizeof(struct pcm_config)); /* Use large value for stop_threshold so that automatic trigger for stop is avoided, when this thread fails to write data */ @@ -4330,9 +4354,6 @@ static void *dummybuf_thread(void *context) ALOGD("pcm_open: card=%d, id=%d", profile->card, profile->id); } - if (adev->dummybuf_thread_devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE) - mixer = mixer_open(profile->card); - if (mixer) { ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name); if (ctl != NULL) diff --git a/audio/hal/audio_hw.h b/audio/hal/audio_hw.h index 9923d77..15ed4bd 100644 --- a/audio/hal/audio_hw.h +++ b/audio/hal/audio_hw.h @@ -167,8 +167,8 @@ enum { #define CAPTURE_DEFAULT_SAMPLING_RATE 48000 #define CAPTURE_START_THRESHOLD 1 -#define COMPRESS_CARD 0 -#define COMPRESS_DEVICE 5 +#define COMPRESS_CARD 2 +#define COMPRESS_DEVICE 0 #define COMPRESS_OFFLOAD_FRAGMENT_SIZE (32 * 1024) #define COMPRESS_OFFLOAD_NUM_FRAGMENTS 4 /* ToDo: Check and update a proper value in msec */ diff --git a/mixer_paths_0.xml b/mixer_paths_0.xml index 168cbff..f7b15df 100644 --- a/mixer_paths_0.xml +++ b/mixer_paths_0.xml @@ -11,17 +11,13 @@ <!-- TODO other defaults --> <path name="speaker"> - <ctl name="SPK VMixer SPK Switch" value="1"/> </path> <path name="headphones"> <ctl name="Headphone Jack Switch" value="1"/> - <ctl name="Codec VMixer Codec Switch" value="1"/> </path> <path name="speaker-and-headphones"> - <ctl name="SPK VMixer SPK Switch" value="1"/> - <ctl name="Codec VMixer Codec Switch" value="1"/> <ctl name="Headphone Jack Switch" value="1"/> </path> |