问题详情
有一个脚本,只要做midi应该都要用,就是打开轨道的音源界面, 包括多通道的轨道,也需要快速的打开音源界面,我用了下面这个脚本很好的解决了多通道和单通道的快速打开音源界面,但这个脚本对效果器无效,有没有办法既可以打开音源,又可以打开效果器呢?
-- (C) 2018, Dominik Martin Drzic, REAPER ReWorked (https://forum.cockos.com/showthread.php?t=225041)
-- Main ----------------------------------------------------------------------------------------------------------------
function Main ()
local trackFxToProcess = {}
local doShow = false
for i = 0, reaper.CountSelectedTracks2(0, false)-1 do
local track = reaper.GetSelectedTrack(0, i)
local fx = reaper.TrackFX_GetInstrument(track)
-- No instrument found on selected track, search parent tracks if any
if fx == -1 then
local parentTrack
local tmpTrack = track
repeat
parentTrack = reaper.GetParentTrack(tmpTrack)
if parentTrack ~= nil then
fx = reaper.TrackFX_GetInstrument(parentTrack)
if fx ~= -1 then
track = parentTrack
break
end
tmpTrack = parentTrack
end
until parentTrack == nil
end
-- No instrument found on selected track nor any parent tracks, search sends
if fx == -1 then
for sendId = 0, reaper.GetTrackNumSends(track, 0)-1 do
local destTrack = reaper.BR_GetMediaTrackSendInfo_Track(track, 0, sendId, 1)
fx = reaper.TrackFX_GetInstrument(destTrack)
if fx ~= -1 then
track = destTrack
break
end
end
end
-- Instrument found, save it for processing later and check what do to
if fx ~= -1 then
trackFxToProcess[i+1] = {}
trackFxToProcess[i+1].fx = fx
trackFxToProcess[i+1].track = track
if reaper.TrackFX_GetFloatingWindow(track, fx) == nil then
doShow = true
end
end
end
if #trackFxToProcess > 0 then
reaper.Undo_BeginBlock2(0)
for _, v in ipairs(trackFxToProcess) do
if doShow == true then
reaper.TrackFX_Show(v.track, v.fx, 3)
fxShown = true
else
reaper.TrackFX_Show(v.track, v.fx, 2)
fxShown = false
end
end
reaper.Undo_EndBlock2(0, "Toggle float instrument FX for selected tracks", 2)
end
end
Main()
function NoUndoPoint () end -- Makes sure there is no unnecessary undo point created, see more
reaper.defer(NoUndoPoint) -- here: http://forum.cockos.com/showpost.php?p=1523953&postcount=67