-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprdc_takes_merge.lua
50 lines (41 loc) · 1.08 KB
/
prdc_takes_merge.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
ardour {
["type"] = "EditorAction",
name = "PRDC Takes merge",
author = "doojonio",
license = "GPL",
description = [[Merges playlists on different tracks to one on the last selected track]],
}
function factory()
local function is_it_ok()
local md = LuaDialog.Message(
"Confirm", "Are you sure?",
LuaDialog.MessageType.Question,
LuaDialog.ButtonType.Yes_No
)
local answer = md:run()
md = nil
collectgarbage()
return answer == 3
end
return function()
if (not is_it_ok()) then
return
end
local sel = Editor:get_selection()
local main_playlist = nil
local rl = sel.tracks:routelist()
rl:reverse()
for r in rl:iter() do
if (not main_playlist) then
main_playlist = r:to_track():playlist()
goto continue
end
local pl = r:to_track():playlist()
for reg in pl:region_list():iter() do
local clone = ARDOUR.RegionFactory.clone_region(reg, false, false)
main_playlist:add_region(clone, reg:position(), 1, false)
end
::continue::
end
end
end