summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-04-24 04:12:13 +0200
committerRobin Gareus <robin@gareus.org>2017-04-24 04:21:25 +0200
commitb7b1ccc8b611fed8942c9c66b727a075b1cd0e47 (patch)
treeaed12f4ca864be30cc43594728af11c1aac1a125 /scripts
parent201fd55743367aca35561507fa3cc552037a6c58 (diff)
Simplify example script
Now that AutomationList is-a ControlList no explicit cast is needed.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/s_fader_automation.lua13
1 files changed, 4 insertions, 9 deletions
diff --git a/scripts/s_fader_automation.lua b/scripts/s_fader_automation.lua
index aaac7adfe9..a9e0afe3f0 100644
--- a/scripts/s_fader_automation.lua
+++ b/scripts/s_fader_automation.lua
@@ -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 ()