1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
From d05d443a084a9a0b34d77cea8af101abd5f57b03 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Marc-Andr=C3=A9=20Lureau?= <marc-andre.lureau@nokia.com>
Date: Tue, 10 Mar 2009 17:43:55 +0200
Subject: [PATCH 23/66] pulsecore: propagate flat-vol recursively
---
src/pulsecore/sink.c | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 10f32a9..930a87d 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1128,27 +1128,25 @@ void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume) {
update_input_soft_volume(s, new_volume, &s->channel_map);
}
-/* Called from main thread */
-void pa_sink_propagate_flat_volume(pa_sink *s) {
+static void propagate_flat_volume(pa_sink *s, pa_sink *master_sink) {
pa_sink_input *i;
uint32_t idx;
- pa_sink_assert_ref(s);
- pa_assert(PA_SINK_IS_LINKED(s->state));
- pa_assert(s->flags & PA_SINK_FLAT_VOLUME);
-
- /* This is called whenever the sink volume changes that is not
- * caused by a sink input volume change. We need to fix up the
- * sink input volumes accordingly */
-
for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
pa_cvolume sink_volume, new_virtual_volume;
unsigned c;
+ if (i->origin_sink) {
+ /* go recursively on slaved flatten sink
+ * and ignore this intermediate sink-input. */
+ propagate_flat_volume(i->origin_sink, master_sink);
+ continue;
+ }
+
/* This basically calculates i->virtual_volume := i->relative_volume * s->virtual_volume */
- sink_volume = s->virtual_volume;
- pa_cvolume_remap(&sink_volume, &s->channel_map, &i->channel_map);
+ sink_volume = master_sink->virtual_volume;
+ pa_cvolume_remap(&sink_volume, &master_sink->channel_map, &i->channel_map);
for (c = 0; c < i->sample_spec.channels; c++)
new_virtual_volume.values[c] = pa_sw_volume_from_linear(
@@ -1178,6 +1176,19 @@ void pa_sink_propagate_flat_volume(pa_sink *s) {
}
/* Called from main thread */
+void pa_sink_propagate_flat_volume(pa_sink *s) {
+
+ pa_sink_assert_ref(s);
+ pa_assert(PA_SINK_IS_LINKED(s->state));
+ pa_assert(s->flags & PA_SINK_FLAT_VOLUME);
+
+ /* This is called whenever the sink volume changes that is not
+ * caused by a sink input volume change. We need to fix up the
+ * sink input volumes accordingly */
+ propagate_flat_volume(s, s);
+}
+
+/* Called from main thread */
void pa_sink_set_volume(pa_sink *s, const pa_cvolume *volume, pa_bool_t propagate, pa_bool_t sendmsg, pa_bool_t become_reference) {
pa_bool_t virtual_volume_changed;
--
1.6.3.1
|