Merge pull request #31 from jmccrohan/contrib_pulse_round

contrib: make pulse round rather than floor volume
This commit is contained in:
Jörg Thalheim 2017-02-27 10:24:55 +01:00 committed by GitHub
commit d266d95b00
1 changed files with 2 additions and 1 deletions

View File

@ -81,8 +81,9 @@ local function worker(format, sink)
local vol = tonumber(string.match(data, "set%-sink%-volume "..escape(sink).." (0x[%x]+)"))
if vol == nil then vol = 0 end
volpercent = vol/0x10000*100
return { math.floor(vol/0x10000*100), "on"}
return { volpercent % 1 >= 0.5 and math.ceil(volpercent) or math.floor(volpercent), "on"}
end
-- }}}