alsa: Merge pa_alsa_setting_select with pa_alsa_path_select

As these functions are called together and are related, we might merge
them and call setting_select from pa_alsa_path_select by passing
optional pa_alsa_setting argument.

Make also the setting_select static as it is not called outside of
alsa-mixer.c after this change.

[Additional note from Tanu Kaskinen: this change improves the
mute-during-activation feature, because now the mixer changes related
to selecting the setting happen while the hw is muted.]
This commit is contained in:
Jarkko Nikula 2012-03-22 11:29:12 +02:00 committed by Tanu Kaskinen
parent fbb13a0dc6
commit 079569753e
4 changed files with 14 additions and 27 deletions

View file

@ -50,6 +50,8 @@
#include "alsa-mixer.h"
#include "alsa-util.h"
static int setting_select(pa_alsa_setting *s, snd_mixer_t *m);
struct description_map {
const char *name;
const char *description;
@ -1196,7 +1198,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) {
return r;
}
int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m, bool device_is_muted) {
int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, bool device_is_muted) {
pa_alsa_element *e;
int r = 0;
@ -1257,6 +1259,9 @@ int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m, bool device_is_muted) {
return -1;
}
if (s)
setting_select(s, m);
/* Finally restore hw mute to the device mute status. */
if (p->mute_during_activation) {
PA_LLIST_FOREACH(e, p->elements) {
@ -2228,7 +2233,7 @@ static int element_set_option(pa_alsa_element *e, snd_mixer_t *m, int alsa_idx)
return r;
}
int pa_alsa_setting_select(pa_alsa_setting *s, snd_mixer_t *m) {
static int setting_select(pa_alsa_setting *s, snd_mixer_t *m) {
pa_alsa_option *o;
uint32_t idx;