Skip to content

Commit d266d95

Browse files
authored
Merge pull request #31 from jmccrohan/contrib_pulse_round
contrib: make pulse round rather than floor volume
2 parents f2aa096 + f7f63f1 commit d266d95

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)