forked from gessl/urMus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlivecoding_interface_final.lua
More file actions
executable file
·62 lines (46 loc) · 1.28 KB
/
Copy pathlivecoding_interface_final.lua
File metadata and controls
executable file
·62 lines (46 loc) · 1.28 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
bg = createRegion(bgH, bgW, offY, offX, nil, 100,100,100,255)
bg:EnableInput(true)
bg.key = createRegion(100,100,200,300,bg, 200,200,200,100)
DPrint("livecoding ready")
yhair = createYhair(bg)
xhair = createXhair(bg)
function pDown(self,y,x)
self.key.t:SetSolidColor(255,100,100,200)
self.key:MoveTo(y,x)
yhair:MoveTo(bgH/2,x)
xhair:MoveTo(y,bgW/2)
local xval = x / bgW * num_notes + base_note
pushFreq:Push(freq2Norm(noteNum2Freq(xval)))
local yval = (y/bgH -0.5 )
-- self.t:SetSolidColor(50*(xval),50*(xval*2),100*yval+255,255)
if yval >= 0 then
yval = pow (yval,3)
end
pushNon:Push(yval)
pushAsymp:Push(0.3)
local w = ScreenWidth()/100
-- bg.t:SetBrushColor(math.random(128,255),0,0,20)
-- bg.t:Point(y,x+offX)
--,ey,ex)
end
bg:Handle("OnTouchDown", pDown)
bg:Handle("OnMove", pDown)
function pUp(self,y,x)
self.key.t:SetSolidColor(100,100,255,200)
self.t:SetSolidColor(100,50,50,255)
pushAsymp:Push(0)
end
bg:Handle("OnTouchUp", pUp)
bg.t:SetTexCoord(0,bgH/ScreenHeight(),bgW/ScreenHeight(),0.0)
r = Region()
r.t = r:Texture(255,255,255,255)
r.t:SetTexture("Ornament1.png")
bg.t:SetBlendMode("BLEND")
bg.t:Clear(255,255,255,255)
r:UseAsBrush()
bg.t:SetBrushSize(64)
--createClear()
labels={}
for i=0,num_notes-1 do
labels[i] = createNoteName(i,50,bgW/num_notes)
end