I have just upgraded to Ardour 7.3.0 from v6.9 on Ubuntu.
The problem is that, some scripts which were working fine on v6.9, stopped working on v7.3.
I keep getting errors for Session object. Specifically for:
for route in Session:get_tracks ():iter () do
The error message is:
LuaException: [string "ardour {..."]:30: attempt to index a nil value (global 'Session')
How can I fix the problem? Any idea?
Here are the whole code:
ardour {
["type"] = "EditorAction",
name = "mb:SelectAllNextRegions",
license = "MIT",
author = "mb",
description = [[Select all regions after selection.]]
}
function factory () return function ()
-- local ok, ext = Editor:get_selection_extents (0, 0)
local ok, ext = Editor:get_selection_extents(Temporal.timepos_t:zero(true), Temporal.timepos_t:zero(true))
local start_pos = 0;
if (ok) then
print(ok)
start_pos = ext[1]
--end_pos = ext[2]
-- print ("Selection Extents:", ext[1], ext[2])
end
print("start_pos:", start_pos)
local sl = ArdourUI.SelectionList () -- empty selection list
local sel = Editor:get_selection () -- get current selection
-- for each selected track/bus..
for route in Session:get_tracks ():iter () do
-- consider only tracks
local track = route:to_track ()
if track:isnil() then
goto continue
end
-- iterate over all regions of the given track
for region in track:playlist():region_list():iter() do
print(region:name(), region:position());
if (region:position () < start_pos) then
-- skip regions before the start point.
else
-- get RegionView (GUI object to be selected)
local rv = Editor:regionview_from_region (region)
-- add it to the list of Objects to be selected
sl:push_back (rv);
end
end
::continue::
end
-- set/replace current selection in the editor
Editor:set_selection (sl, ArdourUI.SelectionOp.Set);
end end