1 ardour { ["type"] = "Snippet", name = "Thin Fader Automation" }
4 -- For a fully fledged EditorAction this script should
5 -- offer a dropdown to select automation of all paramaters
6 -- (not just the fader)
7 -- see scripts/midi_cc_to_automation.lua and
8 -- scripts/mixer_settings_store.lua
9 -- Thinning Area should also be a numeric-entry or slider
11 function factory () return function ()
12 -- get selected tracks
13 rl = Editor:get_selection ().tracks:routelist ()
15 -- prepare undo operation
16 Session:begin_reversible_command ("Thin Automation")
17 local add_undo = false -- keep track if something has changed
19 -- iterate over selected tracks
20 for r in rl:iter () do
22 -- get the Fader (aka "amp") control
23 local ac = r:amp ():gain_control () -- ARDOUR:AutomationControl
24 local al = ac:alist () -- ARDOUR:AutomationList
27 local before = al:get_state ()
29 -- remove dense events
30 al:thin (50) -- threashold of area below curve
33 local after = al:get_state ()
34 Session:add_command (al:memento_command (before, after))
40 -- all done, commit the combined Undo Operation
42 -- the 'nil' Commend here mean to use the collected diffs added above
43 Session:commit_reversible_command (nil)
45 Session:abort_reversible_command ()