Simplify example script
Now that AutomationList is-a ControlList no explicit cast is needed.
This commit is contained in:
parent
201fd55743
commit
b7b1ccc8b6
|
@ -15,35 +15,30 @@ function factory () return function ()
|
|||
for r in rl:iter () do
|
||||
local ac = r:amp ():gain_control () -- ARDOUR:AutomationControl
|
||||
local al = ac:alist () -- ARDOUR:AutomationList (state, high-level)
|
||||
local cl = al:list () -- Evoral:ControlList (actual events)
|
||||
|
||||
if cl:isnil () then
|
||||
goto out
|
||||
end
|
||||
|
||||
-- set automation state to "Touch"
|
||||
ac:set_automation_state (ARDOUR.AutoState.Touch)
|
||||
|
||||
-- query the value at the playhead position
|
||||
local g = cl:eval (playhead)
|
||||
local g = al:eval (playhead)
|
||||
|
||||
-- get state for undo
|
||||
local before = al:get_state ()
|
||||
|
||||
-- delete all events after the playhead...
|
||||
cl:truncate_end (playhead)
|
||||
al:truncate_end (playhead)
|
||||
|
||||
-- ...and generate some new ones.
|
||||
for i=0,50 do
|
||||
-- use a sqrt fade-out (the shape is recognizable, and otherwise
|
||||
-- not be possible to achieve with existing ardour fade shapes)
|
||||
cl:add (playhead + i * samplerate / 50,
|
||||
al:add (playhead + i * samplerate / 50,
|
||||
g * (1 - math.sqrt (i / 50)),
|
||||
false, true)
|
||||
end
|
||||
|
||||
-- remove dense events
|
||||
cl:thin (20)
|
||||
al:thin (20)
|
||||
|
||||
-- save undo
|
||||
local after = al:get_state ()
|
||||
|
|
Loading…
Reference in New Issue