From 6eeed82fb3be60c18406e519c17a2abe10c5a3a1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 13 Dec 2025 21:46:15 +0100 Subject: [PATCH] Update Lua script to use new RouteGroup API --- share/scripts/_fan_out_instrument.lua | 2 +- share/scripts/_rgh_midi_track_trick.lua | 4 ++-- share/scripts/_route_template_generic_audio.lua | 4 ++-- share/scripts/_route_template_generic_midi.lua | 2 +- share/scripts/_stereo_to_mono.lua | 2 +- share/scripts/add_audio_track.lua | 6 +++--- share/scripts/create_drum_tracks.lua | 2 +- share/scripts/s_add_sources_to_track.lua | 2 +- share/scripts/s_ducks.lua | 2 +- share/scripts/send_to_bus.lua | 2 +- share/scripts/session_template_record.lua | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/share/scripts/_fan_out_instrument.lua b/share/scripts/_fan_out_instrument.lua index 3fdf4ef907..67c35bfea5 100644 --- a/share/scripts/_fan_out_instrument.lua +++ b/share/scripts/_fan_out_instrument.lua @@ -45,7 +45,7 @@ function factory () return function () for t,c in pairs (targets) do local rt = Session:route_by_name (t) if rt:isnil () then - Session:new_audio_route (c, outputs, nil, 1, t, ARDOUR.PresentationInfo.Flag.AudioBus, ARDOUR.PresentationInfo.max_order) + Session:new_audio_route (c, outputs, ARDOUR.RouteGroup(), 1, t, ARDOUR.PresentationInfo.Flag.AudioBus, ARDOUR.PresentationInfo.max_order) end end diff --git a/share/scripts/_rgh_midi_track_trick.lua b/share/scripts/_rgh_midi_track_trick.lua index 63c9accdfb..f91cdb7eb8 100644 --- a/share/scripts/_rgh_midi_track_trick.lua +++ b/share/scripts/_rgh_midi_track_trick.lua @@ -15,7 +15,7 @@ end function factory (p) return function () local name = "Sweet16" local insert_at = ARDOUR.PresentationInfo.max_order - local group = nil + local group = ARDOUR.RouteGroup() -- check for "MIDI Channel Map" LV2 from x42 midifilters.lv2 if ARDOUR.LuaAPI.new_plugin_info ("http://gareus.org/oss/lv2/midifilter#channelmap", ARDOUR.PluginType.LV2):isnil () then @@ -27,7 +27,7 @@ function factory (p) return function () -- used from the AddRouteDialog (or w/action_params) name = p["name"] or 'Sweet16' insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order; - group = p["group"] or nil + group = p["group"] or ARDOUR.RouteGroup() else -- used standalone, prompt for name and insert position local dialog_options = { diff --git a/share/scripts/_route_template_generic_audio.lua b/share/scripts/_route_template_generic_audio.lua index 3fe128ec40..cb351e336d 100644 --- a/share/scripts/_route_template_generic_audio.lua +++ b/share/scripts/_route_template_generic_audio.lua @@ -51,7 +51,7 @@ function factory (p) local how_many = p["how_many"] or 1 local channels = p["channels"] or 1 local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order; - local group = p["group"] or nil + local group = p["group"] or ARDOUR.RouteGroup() local mode = p["track_mode"] or ARDOUR.TrackMode.Normal local strict_io = p["strict_io"] or false local chan_out = 0 @@ -108,7 +108,7 @@ function factory (p) end -- create tracks - local tl = Session:new_audio_track (chan_in, chan_out, nil, rv['tracks'], "", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal) + local tl = Session:new_audio_track (chan_in, chan_out, ARDOUR.RouteGroup(), rv['tracks'], "", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal) -- and optionally record-arm them if rv['recarm'] then for track in tl:iter() do diff --git a/share/scripts/_route_template_generic_midi.lua b/share/scripts/_route_template_generic_midi.lua index 75240b26a1..aa74b9d2de 100644 --- a/share/scripts/_route_template_generic_midi.lua +++ b/share/scripts/_route_template_generic_midi.lua @@ -46,7 +46,7 @@ function factory (params) return function () local name = p["name"] or 'Audio' local how_many = p["how_many"] or 1 local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order; - local group = p["group"] or nil + local group = p["group"] or ARDOUR.RouteGroup() local strict_io = p["strict_io"] or false local instrument = p["instrument"] or nil diff --git a/share/scripts/_stereo_to_mono.lua b/share/scripts/_stereo_to_mono.lua index 9313e5de63..beb127a083 100644 --- a/share/scripts/_stereo_to_mono.lua +++ b/share/scripts/_stereo_to_mono.lua @@ -36,7 +36,7 @@ function factory (params) return function () if channels ~= 2 then goto next end -- create 2 new tracks (using the name of the original track)( - local newtracks = Session:new_audio_track (1, n_chan_out, nil, 2, t:name(), ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) + local newtracks = Session:new_audio_track (1, n_chan_out, ARDOUR.RouteGroup(), 2, t:name(), ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) assert (newtracks:size() == 2) for r in playlist:region_list ():iter () do diff --git a/share/scripts/add_audio_track.lua b/share/scripts/add_audio_track.lua index e9af6b2bb5..1252ddce7a 100644 --- a/share/scripts/add_audio_track.lua +++ b/share/scripts/add_audio_track.lua @@ -9,9 +9,9 @@ ardour { function factory () return function () local sel = Editor:get_selection () if not Editor:get_selection ():empty () and not Editor:get_selection ().tracks:routelist ():empty () then - tr = Session:new_audio_track (1, 2, nil, 1, "Audio", Editor:get_selection ().tracks:routelist ():front():presentation_info_ptr ():order () + 1, ARDOUR.TrackMode.Normal, true) + tr = Session:new_audio_track (1, 2, ARDOUR.RouteGroup(), 1, "Audio", Editor:get_selection ().tracks:routelist ():front():presentation_info_ptr ():order () + 1, ARDOUR.TrackMode.Normal, true) else - tr = Session:new_audio_track (1, 2, nil, 1, "Audio", -1, ARDOUR.TrackMode.Normal, true) + tr = Session:new_audio_track (1, 2, ARDOUR.RouteGroup(), 1, "Audio", -1, ARDOUR.TrackMode.Normal, true) end tr:front ():peak_meter ():set_meter_type (ARDOUR.MeterType.MeterKrms) @@ -63,4 +63,4 @@ end -- r: the route in question. function routePosition(r) return r:presentation_info_ptr():order() -end \ No newline at end of file +end diff --git a/share/scripts/create_drum_tracks.lua b/share/scripts/create_drum_tracks.lua index e6fc338460..4fefea1fbb 100644 --- a/share/scripts/create_drum_tracks.lua +++ b/share/scripts/create_drum_tracks.lua @@ -21,7 +21,7 @@ function factory () return function () local i = 1 while names[i] do - local tl = Session:new_audio_track (1, 2, nil, 1, names[i], + local tl = Session:new_audio_track (1, 2, ARDOUR.RouteGroup(), 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) diff --git a/share/scripts/s_add_sources_to_track.lua b/share/scripts/s_add_sources_to_track.lua index 4aa2254978..352e020d4a 100644 --- a/share/scripts/s_add_sources_to_track.lua +++ b/share/scripts/s_add_sources_to_track.lua @@ -9,7 +9,7 @@ function factory () return function () end -- create a stereo track - local newtracks = Session:new_audio_track (2, n_chan_out, nil, 1, "All Audio Sources", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) + local newtracks = Session:new_audio_track (2, n_chan_out, ARDOUR.RouteGroup(), 1, "All Audio Sources", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) -- and get playlist of the new track -- https://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Playlist local playlist = newtracks:front():playlist() diff --git a/share/scripts/s_ducks.lua b/share/scripts/s_ducks.lua index 21b2a253c4..239660a22d 100644 --- a/share/scripts/s_ducks.lua +++ b/share/scripts/s_ducks.lua @@ -8,7 +8,7 @@ function factory (params) return function () end -- create two mono tracks - local tl = Session:new_audio_track (1, chan_out, nil, 2, "Ducks", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) + local tl = Session:new_audio_track (1, chan_out, ARDOUR.RouteGroup(), 2, "Ducks", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) for t in tl:iter() do t:set_strict_io (true) -- switch tracks to monitor input diff --git a/share/scripts/send_to_bus.lua b/share/scripts/send_to_bus.lua index 6bb8f2ad53..72215776db 100644 --- a/share/scripts/send_to_bus.lua +++ b/share/scripts/send_to_bus.lua @@ -25,7 +25,7 @@ function factory () return function () end if tracks:size () > 0 then - local bus = Session:new_audio_route (chn, chn, nil, 1, "", ARDOUR.PresentationInfo.Flag.AudioBus, ARDOUR.PresentationInfo.max_order) + local bus = Session:new_audio_route (chn, chn, ARDOUR.RouteGroup(), 1, "", ARDOUR.PresentationInfo.Flag.AudioBus, ARDOUR.PresentationInfo.max_order) if bus:size () > 0 then Session:add_internal_sends (bus:front (), ARDOUR.Placement.PostFader, tracks); end diff --git a/share/scripts/session_template_record.lua b/share/scripts/session_template_record.lua index 1adc96743e..dd282bd3e3 100644 --- a/share/scripts/session_template_record.lua +++ b/share/scripts/session_template_record.lua @@ -48,7 +48,7 @@ function factory () return function () end -- create tracks - local tl = Session:new_audio_track (1, 2, nil, rv['tracks'], "", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) + local tl = Session:new_audio_track (1, 2, ARDOUR.RouteGroup(), rv['tracks'], "", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal, true) -- and optionally record-arm them if rv['recarm'] then for track in tl:iter() do