From f7f63f18c1461e1566852ebcf15d7fb9e552cca8 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Sat, 25 Feb 2017 15:27:40 +0000 Subject: [PATCH] contrib: make pulse round rather than floor volume Check volpercent to see if ceil or floor should be used. Signed-off-by: Jonathan McCrohan --- contrib/pulse_all.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/pulse_all.lua b/contrib/pulse_all.lua index 5916bb1..98bd22b 100644 --- a/contrib/pulse_all.lua +++ b/contrib/pulse_all.lua @@ -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 -- }}}