Last active
March 2, 2021 20:18
-
-
Save andr-ew/9183b0fb55dd58ffaee9235e98b03ca6 to your computer and use it in GitHub Desktop.
binary-param-test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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