acp: make hard and soft volume limit

Make a hard volume limit property that is configured with the config and
can never be changed.

Make a soft volume limit property that can be changed at runtime.

The used volume limit is a combination of the soft and hard limit.
This commit is contained in:
Wim Taymans 2026-06-08 17:00:40 +02:00
parent 1a534cd907
commit 64d3ed4710
4 changed files with 53 additions and 43 deletions

View file

@ -142,8 +142,10 @@ pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, si
p->port.direction = data->direction == PA_DIRECTION_OUTPUT ?
ACP_DIRECTION_PLAYBACK : ACP_DIRECTION_CAPTURE;
p->type = data->type;
p->volume_range[0] = 0.0f;
p->volume_range[1] = FLT_MAX;
p->hard_volume_limit[0] = 0.0f;
p->hard_volume_limit[1] = FLT_MAX;
p->soft_volume_limit[0] = p->hard_volume_limit[0];
p->soft_volume_limit[1] = p->hard_volume_limit[1];
p->proplist = pa_proplist_new();
pa_proplist_sets(p->proplist, ACP_KEY_PORT_TYPE, str_port_type(data->type));