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

@ -1364,10 +1364,7 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
data = PA_DEVICE_PORT_DATA(p);
pa_assert_se(u->mixer_path = data->path);
pa_alsa_path_select(u->mixer_path, u->mixer_handle, s->muted);
if (data->setting)
pa_alsa_setting_select(data->setting, u->mixer_handle);
pa_alsa_path_select(u->mixer_path, data->setting, u->mixer_handle, s->muted);
mixer_volume_init(u);
@ -1642,10 +1639,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
data = PA_DEVICE_PORT_DATA(u->source->active_port);
u->mixer_path = data->path;
pa_alsa_path_select(data->path, u->mixer_handle, u->source->muted);
if (data->setting)
pa_alsa_setting_select(data->setting, u->mixer_handle);
pa_alsa_path_select(data->path, data->setting, u->mixer_handle, u->source->muted);
} else {
@ -1655,10 +1649,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
if (u->mixer_path) {
/* Hmm, we have only a single path, then let's activate it */
pa_alsa_path_select(u->mixer_path, u->mixer_handle, u->source->muted);
if (u->mixer_path->settings)
pa_alsa_setting_select(u->mixer_path->settings, u->mixer_handle);
pa_alsa_path_select(u->mixer_path, u->mixer_path->settings, u->mixer_handle, u->source->muted);
} else
return 0;
}