-
Notifications
You must be signed in to change notification settings - Fork 7
/
load_grid.lua
79 lines (62 loc) · 1.45 KB
/
load_grid.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
-- oscgrid/oscarc loader
-- run this to load oscgrid and oscarc into memory
-- you can also use this directly in another script
-- replace grid.connect() with include('lib/oscgrid')
-- and you're off to the races
-- g = grid.connect()
-- local g = include('lib/oscgrid')
local touchoscsourceip = "10.0.1.11"
local touchoscsourceport = 9000
local grds = {}
local g
local grid_w
local grid_h
function init()
connect()
get_grid_names()
--tab.print(grds[1])
--tab.print(grid.vports[1].device)
screen.aa(0)
redraw()
end
function get_grid_names()
-- Get a list of grid devices
for id,device in pairs(grid.vports) do
grds[id] = {name = device.name, id = device.id }
--grds[id].id = device.id
end
end
function connect()
grid.update_devices()
g = include('lib/oscgrid')
local g_id = 2
g.grid.add(g_id, "m12345", "oscgrid", {})
g.key = oscgrid_key
grid_w = g.cols
grid_h = g.rows
--g:rotation(0)
g.oscdest = {touchoscsourceip,touchoscsourceport}
osc.event = function(path, args, from)
g.osc_in(path, args, from, g_id)
end
--print ("cols/rows", grid_w, grid_h)
end
function oscgrid_key(x, y, s)
if s == 1 then
--print('keyon')
--g:led(x,y,15)
--g:refresh()
else
--print('keyoff')
--g:led(x,y,0)
--g:refresh()
end
--print (x .. ' ' .. y .. ' ' .. s)
end
function redraw()
screen.clear()
screen.level(15)
screen.move (0,10)
screen.text('oscgrid loaded')
screen.update()
end