]> git.alsa-project.org Git - alsa-utils.git/commit
alsamixer: fix calculation in set_normalized_volume (overflow)
authorJaroslav Kysela <perex@perex.cz>
Thu, 23 May 2024 11:13:42 +0000 (13:13 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 23 May 2024 11:14:20 +0000 (13:14 +0200)
commit84d0a91f11678096d30b28fed46d396d5b28388e
treebf43bdb877171b76db51c3975a33f547e15029e9
parentcc0bcef81389dab05ca9f150694a2969fae93656
alsamixer: fix calculation in set_normalized_volume (overflow)

Lowering volume below 0 causes overflow spike to 100% volume (volume goes
below 0 and back to 100 repeatedly). 0 overflows past infinity when holding
down z,x,c.

> value = lrint_dir(6000.0 * log10(volume), dir) + max;
   (where volume = 0 , and dir = -1 . min = -9999999 , and max = -6)
> log10(0) is negative infinity = error

Fixes: https://github.com/alsa-project/alsa-utils/pull/266
Reported-by: genr8eofl <genBTC@gmx.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsamixer/volume_mapping.c