-
Notifications
You must be signed in to change notification settings - Fork 0
/
punchcard.lua
74 lines (64 loc) · 1.34 KB
/
punchcard.lua
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
65
66
67
68
69
70
71
72
73
74
--
-- ////\\\\
-- ////\\\\ PUNCHCARD
-- ////\\\\ BY NEAUOIRE
-- \\\\////
-- \\\\//// 255 SEQUENCER
-- \\\\////
--
local mdh = include('lib/mdh')
local navi = include('lib/navi')
local stack = include('lib/stack')
local instructor = include('lib/instructor')
local operator = include('lib/operator')
-- Main
function init()
-- Setup
navi:bind(stack,instructor,operator)
stack:bind(navi,instructor)
operator:bind(navi,stack,instructor,mdh)
-- Init
mdh:init()
stack:init()
navi:init()
instructor:init()
operator:init()
-- Params
params:add{type = "number", id = "bpm", name = "BPM", min = 40, max = 400, default = 120, action=function(val) navi:set_bpm(val) end}
-- Render Style
screen.level(15)
screen.aa(0)
screen.line_width(1)
-- Ready
navi:start()
print('Ready.')
end
-- Interactions
function key(id,state)
if id == 2 and state == 1 then
stack:erase_card()
end
if id == 3 and state == 1 then
navi:toggle_play()
end
end
function enc(id,delta)
end
function redraw()
navi.grid:all(0)
screen.clear()
if navi:is_connected() ~= true then
navi:view_error()
elseif navi:in_card() then
navi:grid_card()
navi:view_card()
else
navi:grid_home()
navi:view_home()
end
navi.grid:refresh()
screen.update()
end
function cleanup()
self.operator:release_midi()
end