-
Notifications
You must be signed in to change notification settings - Fork 0
/
gate_soft.lua
59 lines (47 loc) · 1.43 KB
/
gate_soft.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
local libcore = require "core.libcore"
local app = app
local Class = require "Base.Class"
local Unit = require "Unit"
local Gate = require "Unit.ViewControl.Gate"
local ply = app.SECTION_PLY
local gate = Class{}
gate:include(Unit)
function gate:init(args)
args.title = "gate soft"
args.mnemonic = "gts"
Unit.init(self,args)
end
function gate:onLoadGraph(channelCount)
local vca1 = self:addObject("vca1", app.Multiply())
local trig = self:addObject("trig", app.Comparator())
trig:setGateMode()
local slew = self:addObject("slew", libcore.SlewLimiter())
slew:setOptionValue("Direction", 2)
slew:hardSet("Time",.001)
connect(self,"In1",vca1,"Left")
connect(vca1,"Out",self,"Out1")
connect(trig,"Out",slew,"In")
connect(slew,"Out",vca1,"Right")
if channelCount==2 then
local vca2 = self:addObject("vca2", app.Multiply())
connect(self,"In2",vca2,"Left")
connect(vca2,"Out",self,"Out2")
connect(slew,"Out",vca2,"Right")
end
self:addMonoBranch("trig",trig,"In",trig,"Out")
end
function gate:onLoadViews(objects,branches)
local views = {
expanded = {"trig"},
collapsed = {},
}
local controls = {}
controls.trig = Gate {
button = "open",
branch = branches.trig,
description = "Unit Trigger",
comparator = objects.trig,
}
return controls, views
end
return gate