Skip to content

Commit 0ea9a8d

Browse files
authored
Create smandrap_Track lanes: Delete lanes (including media items) that are playing.lua
1 parent 0900942 commit 0ea9a8d

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
-- @description Track lanes: Delete lanes (including media items) that are playing
2+
-- @author smandrap
3+
-- @version 1.0
4+
-- @donation https://paypal.me/smandrap
5+
-- @about
6+
-- https://forum.cockos.com/showthread.php?p=2889040
7+
8+
9+
local r = reaper
10+
11+
local sel_tr_cnt = r.CountSelectedTracks(0)
12+
if sel_tr_cnt == 0 then return end
13+
14+
local function DeleteActiveLanes(track)
15+
local numlanes = r.GetMediaTrackInfo_Value(track, "I_NUMFIXEDLANES")
16+
if numlanes == 1 then
17+
if r.GetMediaTrackInfo_Value(track, "C_LANEPLAYS:0") > 0 then
18+
for i = r.CountTrackMediaItems(track) - 1, 0, -1 do
19+
r.DeleteTrackMediaItem(track, r.GetTrackMediaItem(track, i))
20+
end
21+
end
22+
return
23+
end
24+
25+
for i = 0, numlanes - 1 do
26+
local laneplays = r.GetMediaTrackInfo_Value(track, "C_LANEPLAYS:" .. i)
27+
r.SetMediaTrackInfo_Value(track, "C_LANEPLAYS:" .. i, laneplays == 0 and 2 or 0)
28+
end
29+
30+
r.Main_OnCommand(42691, 0) --Track lanes: Delete lanes (including media items) that are not playing
31+
32+
numlanes = r.GetMediaTrackInfo_Value(track, "I_NUMFIXEDLANES")
33+
for i = 0, numlanes - 1 do
34+
r.SetMediaTrackInfo_Value(track, "C_LANEPLAYS:" .. i, 0)
35+
end
36+
end
37+
38+
r.PreventUIRefresh(1)
39+
for i = 0, sel_tr_cnt - 1 do DeleteActiveLanes(r.GetSelectedTrack(0, i)) end
40+
r.PreventUIRefresh(-1)

0 commit comments

Comments
 (0)