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

@ -668,8 +668,19 @@ This option does nothing if `api.alsa.use-acp` is set to `false`.
@PAR@ device-prop api.alsa.soft-mixer = false # boolean
Setting this option to `true` will disable the hardware mixer for volume
control and mute. All volume handling will then use software volume and mute,
leaving the hardware mixer untouched. The hardware mixer will still be used
to mute unused audio paths in the device.
leaving the hardware mixer untouched. This can be interesting to work around
bugs in the mixer detection or decibel reporting. The hardware mixer will still
be used to mute unused audio paths in the device. Use `api.alsa.disable-mixer-path`
to also disable mixer path selection.
@PAR@ device-prop api.alsa.disable-mixer-path = false # boolean
Setting this option to `true` will disable the hardware mixer path selection.
The hardware mixer path is the configuration of the mixer depending on the
jacks that are inserted in the card. If this is disabled, you will have to
manually enable and disable mixer controls but it can be used to work around
bugs in the mixer. The hardware mixer will still be used for
volume and mute. Use `api.alsa.soft-mixer` to also disable hardware volume
and mute.
@PAR@ device-prop api.alsa.ignore-dB = false # boolean
Setting this option to `true` will ignore the decibel setting configured by

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;