-
Notifications
You must be signed in to change notification settings - Fork 3
/
TunerControl.lua
47 lines (37 loc) · 1.16 KB
/
TunerControl.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
local app = app
local libAccents = require "Accents.libAccents"
local Class = require "Base.Class"
local ViewControl = require "Unit.ViewControl"
local ply = app.SECTION_PLY
local TunerControl = Class {}
TunerControl:include(ViewControl)
function TunerControl:init(args)
local tuner = args.tuner or
app.logError("%s.init: tuner is missing.", self)
ViewControl.init(self, "circle")
self:setClassName("TunerControl")
local width = args.width or (4 * ply)
local graphic
graphic = app.Graphic(0, 0, width, 64)
self.pDisplay = libAccents.TunerGraphic(0, 0, width, 64)
graphic:addChild(self.pDisplay)
self:setMainCursorController(self.pDisplay)
self:setControlGraphic(graphic)
-- add spots
for i = 1, (width // ply) do
self:addSpotDescriptor{
center = (i - 0.5) * ply
}
end
local subGraphic = app.Graphic(0, 0, 128, 64)
self.subDisplay = libAccents.TunerGraphicSub(0, 0, 128, 64)
subGraphic:addChild(self.subDisplay)
self.subGraphic = subGraphic
self:follow(tuner)
end
function TunerControl:follow(tuner)
self.pDisplay:follow(tuner)
self.subDisplay:follow(tuner)
self.tuner = tuner
end
return TunerControl