mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
acp: add volume base and step
Add a READONLY property flag to makr properties READONLY Set the base_volume and volume_step in the acp device Send the base volume and step as REAONLY properties. Use these in pulse layer.
This commit is contained in:
parent
f75dfde89c
commit
e030445e49
8 changed files with 40 additions and 11 deletions
|
|
@ -384,6 +384,12 @@ static void parse_props(struct global *g, const struct spa_pod *param, bool devi
|
|||
prop->flags & SPA_POD_PROP_FLAG_HARDWARE);
|
||||
break;
|
||||
}
|
||||
case SPA_PROP_volumeBase:
|
||||
spa_pod_get_float(&prop->value, &g->node_info.base_volume);
|
||||
break;
|
||||
case SPA_PROP_volumeStep:
|
||||
spa_pod_get_float(&prop->value, &g->node_info.volume_step);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1037,8 +1043,10 @@ static int set_mask(pa_context *c, struct global *g)
|
|||
g->node_info.device_id = SPA_ID_INVALID;
|
||||
|
||||
ginfo = &node_info;
|
||||
g->node_info.volume = 1.0;
|
||||
g->node_info.volume = 1.0f;
|
||||
g->node_info.mute = false;
|
||||
g->node_info.base_volume = 1.0f;
|
||||
g->node_info.volume_step = 1.0f / (PA_VOLUME_NORM+1);
|
||||
} else if (strcmp(g->type, PW_TYPE_INTERFACE_Port) == 0) {
|
||||
if (g->props == NULL)
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -283,6 +283,8 @@ struct global {
|
|||
float channel_volumes[SPA_AUDIO_MAX_CHANNELS];
|
||||
uint32_t device_id; /* id of device (card) */
|
||||
uint32_t profile_device_id; /* id in profile */
|
||||
float base_volume;
|
||||
float volume_step;
|
||||
} node_info;
|
||||
struct {
|
||||
uint32_t node_id;
|
||||
|
|
|
|||
|
|
@ -149,9 +149,9 @@ static void sink_callback(pa_context *c, struct global *g, struct sink_data *d)
|
|||
i.flags |= PA_SINK_HW_MUTE_CTRL;
|
||||
i.proplist = pa_proplist_new_dict(info->props);
|
||||
i.configured_latency = 0;
|
||||
i.base_volume = PA_VOLUME_NORM;
|
||||
i.base_volume = g->node_info.base_volume * PA_VOLUME_NORM;
|
||||
i.n_volume_steps = g->node_info.volume_step * (PA_VOLUME_NORM+1);
|
||||
i.state = node_state_to_sink(info->state);
|
||||
i.n_volume_steps = PA_VOLUME_NORM+1;
|
||||
i.card = g->node_info.device_id;
|
||||
i.n_ports = 0;
|
||||
i.ports = NULL;
|
||||
|
|
@ -872,9 +872,9 @@ static void source_callback(pa_context *c, struct global *g, struct source_data
|
|||
i.flags = flags;
|
||||
i.proplist = pa_proplist_new_dict(info->props);
|
||||
i.configured_latency = 0;
|
||||
i.base_volume = PA_VOLUME_NORM;
|
||||
i.base_volume = g->node_info.base_volume * PA_VOLUME_NORM;
|
||||
i.n_volume_steps = g->node_info.volume_step * (PA_VOLUME_NORM+1);
|
||||
i.state = node_state_to_source(info->state);
|
||||
i.n_volume_steps = PA_VOLUME_NORM+1;
|
||||
i.card = g->node_info.device_id;
|
||||
i.n_ports = 0;
|
||||
i.ports = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue