[pulse] round volume to integer

This commit is contained in:
Joerg T. (Mic92) 2011-09-01 16:08:02 +02:00
parent 4d7b640752
commit b4158a869a
1 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,9 @@ local string = {
format = string.format, format = string.format,
gmatch = string.gmatch gmatch = string.gmatch
} }
local math = {
floor = math.floor
}
-- }}} -- }}}
@ -71,7 +74,7 @@ local function worker(format, sink)
local vol = tonumber(string.match(data, "set%-sink%-volume "..escape(sink).." (0x[%x]+)")) local vol = tonumber(string.match(data, "set%-sink%-volume "..escape(sink).." (0x[%x]+)"))
if vol == nil then vol = 0 end if vol == nil then vol = 0 end
return { vol/0x10000*100, "on"} return { math.floor(vol/0x10000*100), "on"}
end end
-- }}} -- }}}