mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 14:45:43 +01:00
Merge branch 'master' into mixer-snapshots
This commit is contained in:
parent
db09fe1eb8
commit
ad46ad409a
75 changed files with 3042 additions and 3483 deletions
36
scripts/_sort_tracks_by_name.lua
Normal file
36
scripts/_sort_tracks_by_name.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
ardour {
|
||||
["type"] = "EditorAction",
|
||||
name = "Track Sort",
|
||||
author = "Ardour Lua Taskforce",
|
||||
description = [[Sort tracks alphabetically by name]]
|
||||
}
|
||||
|
||||
function factory () return function ()
|
||||
|
||||
-- sort compare function
|
||||
-- a,b here are http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route
|
||||
-- return true if route "a" should be ordered before route "b"
|
||||
function tsort (a, b)
|
||||
return a:name() < b:name()
|
||||
end
|
||||
|
||||
-- create a sortable list of tracks
|
||||
local tracklist = {}
|
||||
for t in Session:get_tracks():iter() do
|
||||
table.insert(tracklist, t)
|
||||
end
|
||||
|
||||
-- sort the list using the compare function
|
||||
table.sort(tracklist, tsort)
|
||||
|
||||
-- traverse the sorted list and assign "presentation-order" to each track
|
||||
local pos = 1;
|
||||
for _, t in ipairs(tracklist) do
|
||||
t:set_presentation_order(pos)
|
||||
pos = pos + 1
|
||||
end
|
||||
|
||||
-- drop all track references
|
||||
tracklist = nil
|
||||
collectgarbage ()
|
||||
end end
|
||||
Loading…
Add table
Add a link
Reference in a new issue