diff options
Diffstat (limited to 'kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch')
-rw-r--r-- | kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch b/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch new file mode 100644 index 000000000000..2067a4fd9742 --- /dev/null +++ b/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch @@ -0,0 +1,42 @@ +From ffe6a4f4b6f56296165cea8651f35563d168ac89 Mon Sep 17 00:00:00 2001 +From: Quinten Kock <quintenkock@gmail.com> +Date: Wed, 21 Jun 2023 20:51:11 +0200 +Subject: [PATCH] Make setGenericVolume keep balance between channels + +Previously setGenericVolume would apply the same amount of difference +on all channels, making e.g. 100%/50% -> 80%/30%. + +This commit changes it to keep the ratios equal instead, so that the +resulting volume would be 80%/40%, keeping the balance the same. + +BUG: 435840 +FIXED-IN: 5.27.7 + + +(cherry picked from commit cfe4a360f2640d7bd4e2d936804b100a299b268a) +--- + src/context.h | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/context.h b/src/context.h +index 3d1f7525..969fa13b 100644 +--- a/src/context.h ++++ b/src/context.h +@@ -123,9 +123,12 @@ public: + newVolume = qBound<qint64>(0, newVolume, PA_VOLUME_MAX); + pa_cvolume newCVolume = cVolume; + if (channel == -1) { // -1 all channels +- const qint64 diff = newVolume - pa_cvolume_max(&cVolume); ++ const qint64 orig = pa_cvolume_max(&cVolume); ++ const qint64 diff = newVolume - orig; + for (int i = 0; i < newCVolume.channels; ++i) { +- newCVolume.values[i] = qBound<qint64>(0, newCVolume.values[i] + diff, PA_VOLUME_MAX); ++ const qint64 channel = newCVolume.values[i]; ++ const qint64 channelDiff = orig == 0 ? diff : diff * channel / orig; ++ newCVolume.values[i] = qBound<qint64>(0, newCVolume.values[i] + channelDiff, PA_VOLUME_MAX); + } + } else { + Q_ASSERT(newCVolume.channels > channel); +-- +GitLab + |