summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-04-07 01:21:07 +0200
committerLennart Poettering <lennart@poettering.net>2009-04-07 01:21:07 +0200
commite356a03ab2683d81a9725c73e6a58c424646a44f (patch)
tree4bf9f73e49a83d72554f5ab588842217979b7851 /src/pulsecore
parent2c2713a72cbb7388e034575b229cd3fd5700ff9f (diff)
If the sink volume is lowered to 0 and then increased again, make sure all stream volumes follow instead of staying at 0
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/sink.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index a5226320..2c5ceacd 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1028,6 +1028,8 @@ void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
pa_cvolume remapped_new_volume;
+ /* This basically calculates i->soft_volume := i->virtual_volume / new_volume * i->volume_factor */
+
remapped_new_volume = *new_volume;
pa_cvolume_remap(&remapped_new_volume, &s->channel_map, &i->channel_map);
pa_sw_cvolume_divide(&i->soft_volume, &i->virtual_volume, &remapped_new_volume);
@@ -1039,7 +1041,7 @@ void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
/* We don't issue PA_SINK_INPUT_MESSAGE_SET_VOLUME because
* we want the update to have atomically with the sink
* volume update, hence we do it within the
- * pa_sink_set_flat_volume() call below*/
+ * pa_sink_set_flat_volume() call below */
}
}
@@ -1061,6 +1063,8 @@ void pa_sink_propagate_flat_volume(pa_sink *s, const pa_cvolume *old_volume) {
pa_cvolume remapped_old_volume, remapped_new_volume, fixed_volume;
unsigned c;
+ /* This basically calculates i->virtual_volume := i->virtual_volume * s->virtual_volume / old_volume */
+
remapped_new_volume = s->virtual_volume;
pa_cvolume_remap(&remapped_new_volume, &s->channel_map, &i->channel_map);
@@ -1070,7 +1074,7 @@ void pa_sink_propagate_flat_volume(pa_sink *s, const pa_cvolume *old_volume) {
for (c = 0; c < i->sample_spec.channels; c++)
if (remapped_old_volume.values[c] == PA_VOLUME_MUTED)
- fixed_volume.values[c] = PA_VOLUME_MUTED;
+ fixed_volume.values[c] = remapped_new_volume.values[c];
else
fixed_volume.values[c] = (pa_volume_t)
((uint64_t) i->virtual_volume.values[c] *