mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
parent
97ec1ce209
commit
d098c2ba86
2 changed files with 10 additions and 7 deletions
|
|
@ -943,11 +943,11 @@ static void set_mute(pa_alsa_device *dev, bool mute)
|
|||
pa_alsa_path_set_mute(dev->mixer_path, dev->mixer_handle, mute);
|
||||
}
|
||||
|
||||
static void mixer_volume_init(pa_alsa_device *dev)
|
||||
static void mixer_volume_init(pa_card *impl, pa_alsa_device *dev)
|
||||
{
|
||||
pa_assert(dev);
|
||||
|
||||
if (!dev->mixer_path || !dev->mixer_path->has_volume) {
|
||||
if (impl->soft_mixer || !dev->mixer_path || !dev->mixer_path->has_volume) {
|
||||
dev->read_volume = NULL;
|
||||
dev->set_volume = NULL;
|
||||
pa_log_info("Driver does not support hardware volume control, "
|
||||
|
|
@ -990,7 +990,7 @@ static void mixer_volume_init(pa_alsa_device *dev)
|
|||
dev->device.base_volume = pa_sw_volume_to_linear(dev->base_volume);;
|
||||
dev->device.volume_step = 1.0f / dev->n_volume_steps;
|
||||
|
||||
if (!dev->mixer_path || !dev->mixer_path->has_mute) {
|
||||
if (impl->soft_mixer || !dev->mixer_path || !dev->mixer_path->has_mute) {
|
||||
dev->read_mute = NULL;
|
||||
dev->set_mute = NULL;
|
||||
pa_log_info("Driver does not support hardware mute control, falling back to software mute control.");
|
||||
|
|
@ -1055,7 +1055,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB)
|
|||
return 0;
|
||||
}
|
||||
|
||||
mixer_volume_init(dev);
|
||||
mixer_volume_init(impl, dev);
|
||||
|
||||
/* Will we need to register callbacks? */
|
||||
if (dev->mixer_path_set && dev->mixer_path_set->paths) {
|
||||
|
|
@ -1070,7 +1070,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB)
|
|||
else if (dev->mixer_path)
|
||||
need_mixer_callback = dev->mixer_path->has_volume || dev->mixer_path->has_mute;
|
||||
|
||||
if (need_mixer_callback) {
|
||||
if (!impl->soft_mixer && need_mixer_callback) {
|
||||
pa_alsa_mixer_use_for_poll(impl->ucm.mixers, dev->mixer_handle);
|
||||
if (dev->mixer_path_set)
|
||||
pa_alsa_path_set_set_callback(dev->mixer_path_set, dev->mixer_handle, mixer_callback, dev);
|
||||
|
|
@ -1240,6 +1240,8 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
|
|||
if (props) {
|
||||
if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL)
|
||||
impl->use_ucm = (strcmp(s, "true") == 0 || atoi(s) == 1);
|
||||
if ((s = acp_dict_lookup(props, "api.alsa.soft-mixer")) != NULL)
|
||||
impl->soft_mixer = (strcmp(s, "true") == 0 || atoi(s) == 1);
|
||||
if ((s = acp_dict_lookup(props, "api.alsa.ignore-dB")) != NULL)
|
||||
ignore_dB = (strcmp(s, "true") == 0 || atoi(s) == 1);
|
||||
if ((s = acp_dict_lookup(props, "device.profile-set")) != NULL)
|
||||
|
|
@ -1520,7 +1522,7 @@ int acp_device_set_port(struct acp_device *dev, uint32_t port_index)
|
|||
|
||||
data = PA_DEVICE_PORT_DATA(p);
|
||||
d->mixer_path = data->path;
|
||||
mixer_volume_init(d);
|
||||
mixer_volume_init(impl, d);
|
||||
|
||||
sync_mixer(d, p);
|
||||
res = pa_alsa_ucm_set_port(d->ucm_context, p, true);
|
||||
|
|
@ -1529,7 +1531,7 @@ int acp_device_set_port(struct acp_device *dev, uint32_t port_index)
|
|||
|
||||
data = PA_DEVICE_PORT_DATA(p);
|
||||
d->mixer_path = data->path;
|
||||
mixer_volume_init(d);
|
||||
mixer_volume_init(impl, d);
|
||||
|
||||
sync_mixer(d, p);
|
||||
res = 0;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ struct pa_card {
|
|||
pa_proplist *proplist;
|
||||
|
||||
bool use_ucm;
|
||||
bool soft_mixer;
|
||||
|
||||
pa_alsa_ucm_config ucm;
|
||||
pa_alsa_profile_set *profile_set;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue