end)
end
+function clamp(x, min, max)
+ return math.min(math.max(x, min), max)
+end
+
+function mpc:change_volume(change)
+ self:send("status", function(_, status)
+ new_vol = clamp(tonumber(status.volume) + change, 0, 100)
+ self:send("setvol " .. new_vol)
+ end)
+end
+
--[[
-- Example on how to use this (standalone)