-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathB_parameters.lua
More file actions
64 lines (55 loc) · 1.33 KB
/
B_parameters.lua
File metadata and controls
64 lines (55 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--
-- ////\\\\
-- ////\\\\ TUTORIAL
-- ////\\\\ PART 11
-- \\\\////
-- \\\\//// PARAMETERS
-- \\\\////
--
local mdh = include('lib/midi_device_helper')
local viewport = { width = 128, height = 64 }
local actions = {"Yes", "No"}
-- Main
function init()
-- Render Style
screen.level(15)
screen.aa(0)
screen.line_width(1)
-- Render
redraw()
-- Add params with a library
mdh:init()
-- Script Params
params:add{type = "number", id = "number", name = "Number", min = 1, max = 48, default = 4}
params:add{type = "option", id = "action", name = "Action", options = actions, default = 1, action=function(x) print('selection:'..actions[x]) end}
end
-- Render
function draw_frame()
screen.rect(1, 1, viewport.width-1, viewport.height-1)
screen.stroke()
end
function draw_label(id,name,value)
local y = viewport.height - (8 * id)
screen.level(5)
screen.move(5,y)
screen.text(name)
screen.level(15)
screen.move(60,y)
if value then
screen.text(value)
end
screen.fill()
end
function draw_labels()
draw_label(1,'action',actions[params:get("action")])
draw_label(2,'number',params:get("number"))
-- Library
draw_label(5,'midi_output',mdh:get_output_name())
draw_label(4,'midi_input',mdh:get_input_name())
end
function redraw()
screen.clear()
draw_frame()
draw_labels()
screen.update()
end