2017-02-19 18:29:39 -05:00
|
|
|
ardour { ["type"] = "EditorAction", name = "Send Tracks to Bus",
|
|
|
|
license = "MIT",
|
|
|
|
author = "Ardour Team",
|
|
|
|
description = [[Create a Bus and add aux-sends from all selected tracks]]
|
|
|
|
}
|
|
|
|
|
|
|
|
function factory () return function ()
|
|
|
|
-- find number of channels to use for the new bus, follow master-bus' inputs
|
|
|
|
local chn = 2
|
2017-02-19 18:52:40 -05:00
|
|
|
local mst = Session:master_out ();
|
|
|
|
if not mst:isnil () then
|
|
|
|
chn = mst:n_inputs ():n_audio ()
|
2017-02-19 18:29:39 -05:00
|
|
|
end
|
|
|
|
mst = nil -- explicitly drop reference
|
2022-07-01 11:11:05 -04:00
|
|
|
if chn == 0 then chn = 2; end
|
2017-02-19 18:29:39 -05:00
|
|
|
|
|
|
|
local sel = Editor:get_selection () -- get selection
|
2017-02-19 18:52:40 -05:00
|
|
|
local tracks = ARDOUR.RouteListPtr () -- create a new list
|
2017-02-19 18:29:39 -05:00
|
|
|
|
|
|
|
-- find selected *tracks*, add to tracks list
|
|
|
|
for r in sel.tracks:routelist ():iter () do
|
2017-02-19 18:52:40 -05:00
|
|
|
if not r:to_track ():isnil () then
|
|
|
|
tracks:push_back (r)
|
2017-02-19 18:29:39 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-19 18:52:40 -05:00
|
|
|
if tracks:size () > 0 then
|
2017-02-19 18:29:39 -05:00
|
|
|
local bus = Session:new_audio_route (chn, chn, nil, 1, "", ARDOUR.PresentationInfo.Flag.AudioBus, ARDOUR.PresentationInfo.max_order)
|
|
|
|
if bus:size () > 0 then
|
2017-02-19 18:52:40 -05:00
|
|
|
Session:add_internal_sends (bus:front (), ARDOUR.Placement.PostFader, tracks);
|
2017-02-19 18:29:39 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end end
|
|
|
|
|
|
|
|
function icon (params) return function (ctx, width, height, fg)
|
2017-02-19 18:52:40 -05:00
|
|
|
local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil (math.min (width, height) * .5) .. "px")
|
2017-02-19 18:29:39 -05:00
|
|
|
txt:set_text ("\u{2192}B") -- "->B"
|
|
|
|
local tw, th = txt:get_pixel_size ()
|
|
|
|
ctx:move_to (.5 * (width - tw), .5 * (height - th))
|
|
|
|
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
|
|
|
|
txt:show_in_cairo_context (ctx)
|
|
|
|
end end
|