monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
630 stars 145 forks source link

number params type wraps incorrectly #1353

Closed dndrks closed 3 years ago

dndrks commented 3 years ago

too zonked to tackle atm, dropping this here for reminder!

repro:

function init()
  params:add{type = "number", id = "rnd", name = "stuff", min = 1, max = 3, default = 1, wrap = true}
end

goes between 2 + 3 when delta > 0, 2 and 1 when delta < 0

relevant lines: https://github.com/monome/norns/blob/d9967043529dc0b856d0c85480346517f70ee35b/lua/core/params/number.lua#L30-L45

andr-ew commented 3 years ago

this might do it !

while v > self.max do 
    v = v - self.range - 1
end 
while v < self.min do 
    v = v + self.range  + 1
end

if not I have a bug in nest_ :-)

catfact commented 3 years ago

that's right; thank you; but propose we incrase val of self.range instead.