-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheastwind.lua
105 lines (85 loc) · 2.36 KB
/
eastwind.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
-- Eastwind: additive gestures
-- 1.0.0 @junklight
-- l.llllllll.co/eastwind
--
--
--
engine.name ='Eastwind'
eastwind_params = include 'lib/eastwind_params'
gc = include 'lib/gridcontrols'
lc = include 'lib/loopercontrols'
g = grid.connect()
controls = {}
table.insert(controls,lc.new(1,1))
table.insert(controls,lc.new(2,2))
table.insert(controls,gc.new(3, function () return params:get("attack") end, function (x) return params:set("attack",x) end ,{0.1,0.3,0.5,1,5,10}))
table.insert(controls,gc.new(4, function () return params:get("release") end, function (x) return params:set("release",x) end ,{0.1,0.3,0.5,1,5,10}))
table.insert(controls,gc.new(5, function () return params:get("smix") end, function (x) return params:set("smix",x) end ,{0,0.25,0.4,0.6,0.75,1}))
table.insert(controls,gc.new(6, function () return params:get("decay") end, function (x) return params:set("decay",x) end ,{0,1,2,4,10,20}))
table.insert(controls,gc.new(7, function () return params:get("fltfreq") end, function (x) return params:set("fltfreq",x) end ,{0.1,0.6,0.9,1.2,1.4,2}))
table.insert(controls,gc.new(8, function () return params:get("fltres") end, function (x) return params:set("fltres",x) end ,{0.1,0.5,1,2,3,4}))
function init()
eastwind_params.add_params()
grid_dirty = false
momentary = {}
for x = 1,10 do
momentary[x] = {}
for y = 1,8 do
momentary[x][y] = false
end
end
clock.run(grid_redraw_clock)
end
function key(n,z)
end
function redraw()
screen.clear()
screen.move(64,32)
screen.text("eastwind")
screen.update()
end
function grid_redraw_clock()
cnt = 0
while true do
cnt = cnt + 1
if cnt % 100 == 0 then
engine.dnodes()
end
clock.sleep(1/30)
if true or grid_dirty then
grid_redraw()
grid_dirty = false
end
end
end
function grid_redraw()
g:all(0)
g:led(11,1,15)
for x = 1,10 do
for y = 1,8 do
if momentary[x][y] then
g:led(x,y,15)
end
end
end
for k,v in ipairs(controls) do
v:draw(g)
end
g:refresh()
end
function g.key(x,y,z)
if x <= 10 then
key = (((y - 1) * 10) + x ) - 1
if z == 1 then
engine.noteon(key)
else
engine.noteoff(key)
end
momentary[x][y] = z == 1 and true or false
else
for k,v in ipairs(controls) do
v:key(x,y,z)
end
end
grid_dirty = true
end