summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-08-31 21:40:59 +0200
committerLennart Poettering <lennart@poettering.net>2009-08-31 21:40:59 +0200
commit2970c11902b46414d9ff28db1e850d94b137157c (patch)
tree487ca524322221bb32c0ebad246425bed4c33dae /src/pulsecore/sink.c
parente1ce365cd9cdcdfd1535aa58882de249c6274ed4 (diff)
core: always allow volume setting with single-channel pa_cvolume
Diffstat (limited to 'src/pulsecore/sink.c')
-rw-r--r--src/pulsecore/sink.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 48c50b0b..f5a6fc50 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1408,8 +1408,11 @@ void pa_sink_set_volume(
pa_assert_ctl_context();
pa_assert(PA_SINK_IS_LINKED(s->state));
pa_assert(!volume || pa_cvolume_valid(volume));
- pa_assert(!volume || pa_cvolume_compatible(volume, &s->sample_spec));
pa_assert(volume || (s->flags & PA_SINK_FLAT_VOLUME));
+ pa_assert(!volume || volume->channels == 1 || pa_cvolume_compatible(volume, &s->sample_spec));
+
+ /* As a special exception we accept mono volumes on all sinks --
+ * even on those with more complex channel maps */
/* If volume is NULL we synchronize the sink's real and reference
* volumes with the stream volumes. If it is not NULL we update
@@ -1419,7 +1422,10 @@ void pa_sink_set_volume(
if (volume) {
- s->reference_volume = *volume;
+ if (pa_cvolume_compatible(volume, &s->sample_spec))
+ s->reference_volume = *volume;
+ else
+ pa_cvolume_scale(&s->reference_volume, pa_cvolume_max(volume));
if (s->flags & PA_SINK_FLAT_VOLUME) {
/* OK, propagate this volume change back to the inputs */