acp: add api.alsa.disable-mixer-path

Don't use the api.alsa.soft-mixer option to disable the path selection
but make a new api.alsa.disable-mixer-path.

Disabling the path selection might leave cards unusable after suspend,
so a separate option is a better idea.

See #4311
This commit is contained in:
Wim Taymans 2024-09-24 13:14:17 +02:00
parent e9c5ca5978
commit 99c23d5b0e
3 changed files with 20 additions and 6 deletions

View file

@ -1377,7 +1377,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB)
data = PA_DEVICE_PORT_DATA(dev->active_port);
dev->mixer_path = data->path;
if (!impl->soft_mixer)
if (!impl->disable_mixer_path)
pa_alsa_path_select(data->path, data->setting, dev->mixer_handle, dev->muted);
} else {
pa_alsa_ucm_port_data *data;
@ -1387,7 +1387,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB)
/* Now activate volume controls, if any */
if (data->path) {
dev->mixer_path = data->path;
if (!impl->soft_mixer)
if (!impl->disable_mixer_path)
pa_alsa_path_select(dev->mixer_path, NULL, dev->mixer_handle, dev->muted);
}
}
@ -1397,7 +1397,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB)
if (dev->mixer_path) {
/* Hmm, we have only a single path, then let's activate it */
if (!impl->soft_mixer)
if (!impl->disable_mixer_path)
pa_alsa_path_select(dev->mixer_path, dev->mixer_path->settings,
dev->mixer_handle, dev->muted);
} else
@ -1662,6 +1662,8 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
impl->use_ucm = spa_atob(s);
if ((s = acp_dict_lookup(props, "api.alsa.soft-mixer")) != NULL)
impl->soft_mixer = spa_atob(s);
if ((s = acp_dict_lookup(props, "api.alsa.disable-mixer-path")) != NULL)
impl->disable_mixer_path = spa_atob(s);
if ((s = acp_dict_lookup(props, "api.alsa.ignore-dB")) != NULL)
impl->ignore_dB = spa_atob(s);
if ((s = acp_dict_lookup(props, "device.profile-set")) != NULL)
@ -1880,7 +1882,7 @@ static void sync_mixer(pa_alsa_device *d, pa_device_port *port)
setting = data->setting;
}
if (d->mixer_handle && !impl->soft_mixer)
if (d->mixer_handle && !impl->disable_mixer_path)
pa_alsa_path_select(d->mixer_path, setting, d->mixer_handle, d->muted);
if (d->set_mute)

View file

@ -44,6 +44,7 @@ struct pa_card {
bool use_ucm;
bool soft_mixer;
bool disable_mixer_path;
bool auto_profile;
bool auto_port;
bool ignore_dB;