2 ["type"] = "EditorAction",
4 author = "Ardour Lua Taskforce",
5 description = [[Sort tracks alphabetically by name]]
8 function factory () return function ()
10 -- sort compare function
11 -- a,b here are http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route
12 -- return true if route "a" should be ordered before route "b"
14 return a:name() < b:name()
17 -- create a sortable list of tracks
19 for t in Session:get_tracks():iter() do
20 table.insert(tracklist, t)
23 -- sort the list using the compare function
24 table.sort(tracklist, tsort)
26 -- traverse the sorted list and assign "presentation-order" to each track
28 for _, t in ipairs(tracklist) do
29 t:set_presentation_order(pos)
33 -- drop all track references