mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +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`
48 lines
1.4 KiB
Lua
48 lines
1.4 KiB
Lua
ardour {
|
|
["type"] = "session",
|
|
name = "Mixer Scene Sequencer",
|
|
license = "MIT",
|
|
author = "John Devlin, Robin Gareus",
|
|
description = [[Recall a Mixer Scene when the playhead passes over a Marker named 'MS <number>' where <number> indicates the scene to recall.]]
|
|
}
|
|
|
|
function factory ()
|
|
|
|
local MIXER_SCENE_MARKER_PREFIX = "MS "
|
|
|
|
return function (n_samples)
|
|
if (not Session:transport_rolling()) then
|
|
-- not rolling, nothing to do.
|
|
return
|
|
end
|
|
|
|
local pos = Session:transport_sample() -- current playhead position
|
|
local loc = Session:locations() -- all marker locations
|
|
|
|
local tpos = Temporal.timepos_t(pos)
|
|
local mpos = loc:first_mark_after(tpos, false)
|
|
|
|
if (mpos == Temporal.timepos_t.max(tpos:time_domain())) then
|
|
-- no marker was found
|
|
return
|
|
end
|
|
|
|
local mloc = loc:mark_at(mpos, Temporal.timecnt_t(0), 0)
|
|
if not mloc then
|
|
-- no marker found at that location
|
|
return
|
|
end
|
|
|
|
if (pos + n_samples > mpos:samples()) then
|
|
-- the marker is within this sample block
|
|
if mloc:name():sub(1, MIXER_SCENE_MARKER_PREFIX:len()) == MIXER_SCENE_MARKER_PREFIX then
|
|
-- the marker name begins with MIXER_SCENE_MARKER_PREFIX: get the remainder of the name (should be a number)
|
|
local msNum = tonumber(mloc:name():sub(MIXER_SCENE_MARKER_PREFIX:len() + 1))
|
|
if msNum and msNum >= 1 and msNum <= 8 then
|
|
Session:apply_nth_mixer_scene(msNum - 1)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|