Skip to contentSkip to conversation

FIXES: alsamixer lowering volume control widget past 0 causes hostile volume spike to 100

DISCUSSION GitHub pull_request - opened 1 participant 1 message Apr 19, 2024 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

alsa-project/alsa-utils pull request #266 was opened from genbtc:

bug: lowering volume below 0 causes volume to overflow and spike to 100% volume hurting my ears.

to reproduce: when holding down z,x,c to lower the volume, the volume spikes to 100% and then down to 0% over and over

background:
when volume is already 0 and direction is -1 (lowering volume) - but lower than 0 is impossible
the function set_normalized_volume @ volume-mapping.c is eventually still called anyway
value = lrint_dir(6000.0 * log10(volume), dir) + max;
and volume is 0, so
log10(0) resolves to negative infinity, so
value overflows past infinity. 9223372036854775802 ![alsamixer-alsa-utils-volumemap-bug3_2024-04-18_13-27-23](https://github.com/alsa-project/alsa-utils/assets/3683744/d382c59b-0e71-420f-8495-4d5d863f3734)

my fix:
this function change_volume_relative function will now skip execution of the set_normalized_playback_volume function when volume is 0 and the dir is -1
TLDR: (stop trying to set a lower volume than 0)

Request URL : https://github.com/alsa-project/alsa-utils/pull/266
Patch URL : https://github.com/alsa-project/alsa-utils/pull/266.patch
Repository URL: https://github.com/alsa-project/alsa-utils