contrib: make pulse round rather than floor volume
Check volpercent to see if ceil or floor should be used. Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
This commit is contained in:
parent
f2aa096f83
commit
f7f63f18c1
|
@ -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
|
||||
-- }}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue