mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
Second round of Lua script API updates
This commit is contained in:
parent
1abf6a77d6
commit
76c0f42ecb
23 changed files with 76 additions and 112 deletions
|
|
@ -14,7 +14,6 @@ function factory (params) return function ()
|
|||
-- prepare undo operation
|
||||
-- see http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Session
|
||||
Session:begin_reversible_command ("Auto Region Split")
|
||||
local add_undo = false -- keep track if something has changed
|
||||
|
||||
-- Track/Bus Selection -- iterate over all Editor-GUI selected tracks
|
||||
-- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:TrackSelection
|
||||
|
|
@ -40,7 +39,7 @@ function factory (params) return function ()
|
|||
if l:is_mark() then
|
||||
-- get all regions on the given track's playlist (may be stacked)
|
||||
for reg in playlist:regions_at (l:start ()):iter () do
|
||||
playlist:split_region (reg, ARDOUR.MusicSample (l:start(), 0))
|
||||
playlist:split_region (reg, l:start())
|
||||
-- the above operation will invalidate the playlist's region list:
|
||||
-- split creates 2 new regions.
|
||||
--
|
||||
|
|
@ -51,20 +50,14 @@ function factory (params) return function ()
|
|||
end
|
||||
|
||||
-- collect undo data
|
||||
if not Session:add_stateful_diff_command (playlist:to_statefuldestructible ()):empty () then
|
||||
-- is something has changed, we need to save it at the end.
|
||||
add_undo = true
|
||||
end
|
||||
Session:add_stateful_diff_command (playlist:to_statefuldestructible ())
|
||||
|
||||
::continue::
|
||||
end
|
||||
|
||||
-- all done, commit the combined Undo Operation
|
||||
if add_undo then
|
||||
-- the 'nil' Command here mean to use the collected diffs added above
|
||||
if not Session:abort_empty_reversible_command () then
|
||||
Session:commit_reversible_command (nil)
|
||||
else
|
||||
Session:abort_reversible_command ()
|
||||
end
|
||||
|
||||
end end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue