mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Found via `codespell -q 3 -S "*.pdf,*.po,./.git,*.tosc,./waf,./share/patchfiles,./libs,./msvc_extra_headers,./share/web_surfaces,*.patch" -L acount,addin,ane,ba,buss,busses,caf,capela,devine,disconnectin,discreet,doubleclick,envolution,filetest,fo,ghandi,homs,hsi,layed,maschine,mis,nd,ontop,pass-thru,removeable,retrn,ro,scrollin,sectionin,seh,siz,sord,sur,te,trough,ue,wth`
45 lines
1.4 KiB
Lua
45 lines
1.4 KiB
Lua
ardour { ["type"] = "EditorAction", name = "Select Regions at the Playhead",
|
|
license = "MIT",
|
|
author = "Ardour Team",
|
|
description = [[Select regions under the playhead on selected track(s)]]
|
|
}
|
|
|
|
function factory (params) return function ()
|
|
|
|
local loc = Session:locations () -- all marker locations
|
|
|
|
-- get the playhead position
|
|
local playhead = Temporal.timepos_t (Session:transport_sample ())
|
|
|
|
local sl = ArdourUI.SelectionList () -- empty selection list
|
|
|
|
-- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:Selection
|
|
local sel = Editor:get_selection ()
|
|
|
|
-- Track/Bus Selection -- iterate over all Editor-GUI selected tracks
|
|
-- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:TrackSelection
|
|
for r in sel.tracks:routelist ():iter () do
|
|
-- each of the items 'r' is-a
|
|
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route
|
|
|
|
local track = r:to_track () -- see if it's a track
|
|
if track:isnil () then
|
|
-- if not, skip it
|
|
goto continue
|
|
end
|
|
|
|
-- get track's playlist
|
|
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Playlist
|
|
local playlist = track:playlist ()
|
|
|
|
for region in playlist:regions_at (playhead):iter () do
|
|
local rv = Editor:regionview_from_region (region)
|
|
sl:push_back (rv);
|
|
end
|
|
|
|
::continue::
|
|
end
|
|
|
|
-- set/replace current selection in the editor
|
|
Editor:set_selection (sl, ArdourUI.SelectionOp.Set);
|
|
end end
|