mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
remove soft volume from pa_sink_input_new_info since it should be handled internally and automatically by the sink input
This commit is contained in:
parent
b2c923e727
commit
d802a76963
7 changed files with 63 additions and 72 deletions
|
|
@ -80,16 +80,16 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_i
|
|||
|
||||
pa_log_debug("Positioning event sound '%s' at %0.2f.", pa_strnull(pa_proplist_gets(data->proplist, PA_PROP_EVENT_ID)), f);
|
||||
|
||||
if (!data->virtual_volume_is_set) {
|
||||
pa_cvolume_reset(&data->virtual_volume, data->sample_spec.channels);
|
||||
data->virtual_volume_is_set = TRUE;
|
||||
data->virtual_volume_is_absolute = FALSE;
|
||||
if (!data->volume_is_set) {
|
||||
pa_cvolume_reset(&data->volume, data->sample_spec.channels);
|
||||
data->volume_is_set = TRUE;
|
||||
data->volume_is_absolute = FALSE;
|
||||
}
|
||||
|
||||
pa_cvolume_set_balance(&data->virtual_volume, &data->channel_map, f*2.0-1.0);
|
||||
pa_cvolume_set_balance(&data->volume, &data->channel_map, f*2.0-1.0);
|
||||
data->save_volume = FALSE;
|
||||
|
||||
pa_log_debug("Final volume %s.", pa_cvolume_snprint(t, sizeof(t), &data->virtual_volume));
|
||||
pa_log_debug("Final volume %s.", pa_cvolume_snprint(t, sizeof(t), &data->volume));
|
||||
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -396,32 +396,33 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu
|
|||
|
||||
if (u->restore_volume) {
|
||||
|
||||
if (!new_data->virtual_volume_is_set) {
|
||||
if (!new_data->volume_is_set) {
|
||||
pa_cvolume v;
|
||||
pa_cvolume_init(&v);
|
||||
|
||||
if (new_data->sink->flags & PA_SINK_FLAT_VOLUME) {
|
||||
|
||||
/* We don't check for e->device_valid here because
|
||||
that bit marks whether it is a good choice for
|
||||
restoring, not just if the data is filled in. */
|
||||
if (e->absolute_volume_valid &&
|
||||
e->device_valid &&
|
||||
pa_streq(new_data->sink->name, e->device)) {
|
||||
(e->device[0] == 0 || pa_streq(new_data->sink->name, e->device))) {
|
||||
|
||||
v = e->absolute_volume;
|
||||
new_data->virtual_volume_is_absolute = TRUE;
|
||||
new_data->volume_is_absolute = TRUE;
|
||||
} else if (e->relative_volume_valid) {
|
||||
|
||||
v = e->relative_volume;
|
||||
new_data->virtual_volume_is_absolute = FALSE;
|
||||
new_data->volume_is_absolute = FALSE;
|
||||
}
|
||||
|
||||
} else if (e->relative_volume_valid) {
|
||||
v = e->relative_volume;
|
||||
new_data->virtual_volume_is_absolute = FALSE;
|
||||
new_data->volume_is_absolute = FALSE;
|
||||
}
|
||||
|
||||
if (v.channels > 0) {
|
||||
pa_log_info("Restoring volume for sink input %s.", name);
|
||||
pa_sink_input_new_data_set_virtual_volume(new_data, pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map));
|
||||
pa_sink_input_new_data_set_volume(new_data, pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map));
|
||||
new_data->save_volume = TRUE;
|
||||
}
|
||||
} else
|
||||
|
|
@ -531,11 +532,10 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
|
|||
if (si->sink->flags & PA_SINK_FLAT_VOLUME) {
|
||||
|
||||
if (e->absolute_volume_valid &&
|
||||
e->device_valid &&
|
||||
pa_streq(e->device, si->sink->name))
|
||||
(e->device[0] == 0 || pa_streq(e->device, si->sink->name)))
|
||||
v = e->absolute_volume;
|
||||
else if (e->relative_volume_valid) {
|
||||
pa_cvolume t = si->sink->virtual_volume;
|
||||
pa_cvolume t = *pa_sink_get_volume(si->sink, FALSE);
|
||||
pa_sw_cvolume_multiply(&v, &e->relative_volume, pa_cvolume_remap(&t, &si->sink->channel_map, &e->channel_map));
|
||||
}
|
||||
} else if (e->relative_volume_valid)
|
||||
|
|
@ -663,10 +663,11 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
|
|||
|
||||
if ((e = read_entry(u, name))) {
|
||||
pa_cvolume r;
|
||||
pa_channel_map cm;
|
||||
|
||||
pa_tagstruct_puts(reply, name);
|
||||
pa_tagstruct_put_channel_map(reply, &e->channel_map);
|
||||
pa_tagstruct_put_cvolume(reply, e->relative_volume_valid ? &e->relative_volume : pa_cvolume_init(&r));
|
||||
pa_tagstruct_put_channel_map(reply, (e->relative_volume_valid || e->absolute_volume_valid) ? &e->channel_map : pa_channel_map_init(&cm));
|
||||
pa_tagstruct_put_cvolume(reply, e->absolute_volume_valid ? &e->absolute_volume : (e->relative_volume_valid ? &e->relative_volume : pa_cvolume_init(&r)));
|
||||
pa_tagstruct_puts(reply, e->device_valid ? e->device : NULL);
|
||||
pa_tagstruct_put_boolean(reply, e->muted_valid ? e->muted : FALSE);
|
||||
|
||||
|
|
@ -709,18 +710,21 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
|
|||
|
||||
if (pa_tagstruct_gets(t, &name) < 0 ||
|
||||
pa_tagstruct_get_channel_map(t, &entry.channel_map) ||
|
||||
pa_tagstruct_get_cvolume(t, &entry.relative_volume) < 0 ||
|
||||
pa_tagstruct_get_cvolume(t, &entry.absolute_volume) < 0 ||
|
||||
pa_tagstruct_gets(t, &device) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &muted) < 0)
|
||||
goto fail;
|
||||
|
||||
entry.absolute_volume_valid = FALSE;
|
||||
entry.relative_volume_valid = entry.relative_volume.channels > 0;
|
||||
|
||||
if (entry.relative_volume_valid &&
|
||||
entry.channel_map.channels != entry.relative_volume.channels)
|
||||
if (!name || !*name)
|
||||
goto fail;
|
||||
|
||||
entry.relative_volume = entry.absolute_volume;
|
||||
entry.absolute_volume_valid = entry.relative_volume_valid = entry.relative_volume.channels > 0;
|
||||
|
||||
if (entry.relative_volume_valid)
|
||||
if (!pa_cvolume_compatible_with_channel_map(&entry.relative_volume, &entry.channel_map))
|
||||
goto fail;
|
||||
|
||||
entry.muted = muted;
|
||||
entry.muted_valid = TRUE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue