binary-param-test.lua
| -- param test test | |
| cs = require 'controlspec' | |
| px = 48 | |
| py = 16 | |
| function init() | |
| params:add{ type='binary', id='tog', behavior='toggle', action=function(v) print('tog: ' .. tostring(v)) end } | |
| params:add{ type='binary', id='mom', behavior='momentary', action=function(v) print('mom: ' .. tostring(v)) end } | |
| params:add{ type='binary', id='trig', behavior='trigger', action=function(v) print('trig: ' .. tostring(v)) end } | |
| redraw() | |
| end | |
| function key(n, z) | |
| if n==1 and z==1 then | |
| params:delta('trig', z) | |
| elseif n==2 and z==1 then | |
| params:delta('tog', z) | |
| elseif n==3 then | |
| params:delta('mom', z) | |
| end | |
| redraw() | |
| end | |
| function redraw() | |
| screen.move(py + px, py) | |
| screen.level(15) | |
| screen.text('trig') | |
| screen.move(py, py * 2) | |
| screen.level(params:get('tog') == 1 and 15 or 2) | |
| screen.text('tog') | |
| screen.move(py + px, py * 2) | |
| screen.level(params:get('mom') == 1 and 15 or 2) | |
| screen.text('mom') | |
| screen.update() | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment