forked from ReaTeam/ReaScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspk77_Set solo for send X.lua
57 lines (54 loc) · 1.71 KB
/
spk77_Set solo for send X.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-- @version 0.1.1
-- @author spk77
-- @changelog
-- ReaPack packaging enhancement by cfillion (no other code change).
-- @description Set solo for send X
-- @about
-- # Set solo for send X
--
-- Sets solo for send X (by muting all other sends on the track). This works on selected tracks.
-- @metapackage
-- @provides
-- [main] . > spk77_Set solo for send 1.lua
-- [main] . > spk77_Set solo for send 2.lua
-- [main] . > spk77_Set solo for send 3.lua
-- [main] . > spk77_Set solo for send 4.lua
-- [main] . > spk77_Set solo for send 5.lua
function solo_send(send_index)
local tr_count = reaper.CountSelectedTracks(0)
if tr_count == 0 then
return
end
reaper.Undo_BeginBlock()
for i=1, tr_count do
local tr = reaper.GetSelectedTrack(0, i-1)
if tr ~= nil then
-- count hardware outs (this is needed to get the correct send index)
local tr_num_hw_outs = reaper.GetTrackNumSends(tr, 1)
local send_count = reaper.GetTrackNumSends(tr, 0)
if send_index > tr_num_hw_outs + send_count-1 then
goto continue
end
for i=tr_num_hw_outs, send_count-1 do
local ret, is_muted = reaper.GetTrackSendUIMute(tr, i)
if i == send_index then
if is_muted then
reaper.ToggleTrackSendUIMute(tr, tr_num_hw_outs + i)
end
elseif i ~= send_target then
if not is_muted then
reaper.ToggleTrackSendUIMute(tr, tr_num_hw_outs + i)
end
end
end
end
::continue::
end
reaper.Undo_EndBlock("Set solo for send", -1)
end
local slot = tonumber(({reaper.get_action_context()})[2]:match("send (%d+).lua"))
if slot then
solo_send(slot - 1)
else
error("could not extract send ID from filename")
end