diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2021-03-03 10:28:17 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2021-03-03 10:28:17 +0000 |
commit | d99093fb4bb5652015c06274d64083daa2439e4f (patch) | |
tree | cf61513204d97974179580065e85df5c8009087c /media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch | |
parent | 463397cf1e064185110fe57c568d73f99a06f5d1 (diff) |
gentoo resync : 03.03.2021
Diffstat (limited to 'media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch')
-rw-r--r-- | media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch new file mode 100644 index 000000000000..6fd28572f90e --- /dev/null +++ b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch @@ -0,0 +1,37 @@ +From 7eed10b2bd4650dadbc2c98f435d2bb10de7f75e Mon Sep 17 00:00:00 2001 +From: Arnaud Rebillout <elboulangero@gmail.com> +Date: Mon, 19 Jun 2017 20:02:01 +0700 +Subject: [PATCH] Clip volume between 0 and 100 (thx to yunake) #162 + +--- + src/audio.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/audio.c b/src/audio.c +index 750f20f..06b245c 100644 +--- a/src/audio.c ++++ b/src/audio.c +@@ -437,11 +437,22 @@ gdouble + audio_get_volume(Audio *audio) + { + AlsaCard *soundcard = audio->soundcard; ++ gdouble volume; + + if (!soundcard) + return 0; + +- return alsa_card_get_volume(soundcard); ++ volume = alsa_card_get_volume(soundcard); ++ ++ /* With PulseAudio, it is perfectly possible for the volume to go above 100%. ++ * Since we don't really expect or handle that, let's clip it right now. ++ */ ++ if (volume < 0) ++ volume = 0; ++ if (volume > 100) ++ volume = 100; ++ ++ return volume; + } + + /** |