Skip to content

Commit f7f63f1

Browse files
committed
contrib: make pulse round rather than floor volume
Check volpercent to see if ceil or floor should be used. Signed-off-by: Jonathan McCrohan <[email protected]>
1 parent f2aa096 commit f7f63f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/pulse_all.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ local function worker(format, sink)
8181

8282
local vol = tonumber(string.match(data, "set%-sink%-volume "..escape(sink).." (0x[%x]+)"))
8383
if vol == nil then vol = 0 end
84+
volpercent = vol/0x10000*100
8485

85-
return { math.floor(vol/0x10000*100), "on"}
86+
return { volpercent % 1 >= 0.5 and math.ceil(volpercent) or math.floor(volpercent), "on"}
8687
end
8788
-- }}}
8889

0 commit comments

Comments
 (0)