-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurTunerExample.lua
More file actions
47 lines (39 loc) · 1.26 KB
/
urTunerExample.lua
File metadata and controls
47 lines (39 loc) · 1.26 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
local mic=_G["FBMic"]
local tuner=FlowBox("object","Tuner",_G["FBTuner"])
local vis=_G["FBVis"]
mic:SetPushLink(0,tuner,0)
tuner:SetPushLink(0,vis,0)
notes={"A","A#","B","C","C#","D","D#","E","F","F#","G","G#"}
backdrop = Region('Region','backdrop',UIParent)
backdrop:SetLayer("TOOPTIP")
backdrop:SetWidth(ScreenWidth());
backdrop:SetHeight(100);
backdrop:SetAnchor("BOTTOMLEFT",0,0)
backdrop:EnableInput(true)
backdrop.texture=backdrop:Texture()
backdrop.texture:SetTexture(0x11,0x22,0x44,0xff)
backdrop:Show()
backdrop.textlabel=backdrop:TextLabel()
backdrop.textlabel:SetFont("Trebuchet MS")
backdrop.textlabel:SetHorizontalAlign("CENTER")
backdrop.textlabel:SetVerticalAlign("TOP")
backdrop.textlabel:SetLabel("Tuner")
backdrop.textlabel:SetFontHeight(40)
backdrop.textlabel:SetColor(255,0,0,255)
backdrop.textlabel:SetShadowColor(255,190,190,190)
backdrop.textlabel:SetShadowOffset(2,-3)
backdrop.textlabel:SetShadowBlur(4.0)
function Update(self)
val=vis:Get()
if val==-1 then
backdrop.textlabel:SetLabel("urTuner")
DPrint("")
else
pitch=math.floor(val*12+0.5)
index=pitch%12+1
per=(val*12-pitch)*100
DPrint(per.."%")
backdrop.textlabel:SetLabel(notes[index])
end
end
backdrop:Handle("OnUpdate",Update)