如何一键打开关闭乐器轨道上的乐器呢?目前设置的动作貌似有冲突

问题详情

因为目前设置的动作貌似打开音源后,命令无法在乐器界面重新触发,必须点到编辑器里面才能关闭,有没有办法可以解决呢。。。

做过的尝试

你当前用的命令具体是哪条

-- (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

用的是这个,因为打开乐器聚焦在了新的乐器窗口,新的乐器窗口无法再响应了

不是太理解你的意思。

我把该脚本放在 toolbar 以及 快捷键 ,这两种方式来运行。无论是鼠标点击,还是快捷键,都能 “toggle” 打开/关闭 vsti 的窗口。

我是 Linux 系统,无论在原生 vsti、wine vsti 都是这个表现。


见 GIF:
script test 20210905a

1 个赞

可能是系统的问题,mac上面没办法正确toggle

1 个赞

我用的也是这个,但我是windows,使用没有你说的问题,不过不能打开效果器,只能打开乐器。

我用的是window,也和你一样