Skip to content

Commit

Permalink
Create smandrap_Select previous track in TCP or in Mixer.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
smandrap committed Feb 14, 2024
1 parent c78c48b commit 0de884e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Navigation/smandrap_Select previous track in TCP or in Mixer.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local mixer_hwnd = reaper.JS_Window_Find("Mixer", true)
local focus = reaper.JS_Window_GetParent(reaper.JS_Window_GetFocus())

local function prev_in_mcp()
local first_sel_t = reaper.GetSelectedTrack(-1, 0) or reaper.GetLastTouchedTrack()
local id = 0

if first_sel_t then id = reaper.GetMediaTrackInfo_Value(first_sel_t, 'IP_TRACKNUMBER') end

for i = id -2, 0, -1 do
local t = reaper.GetTrack(-1, i)
if reaper.IsTrackVisible(t, true) then
reaper.SetOnlyTrackSelected(t)
return
end
end
end


if focus == mixer_hwnd then
reaper.Undo_BeginBlock()
prev_in_mcp()
reaper.Undo_EndBlock("Select Previous Track in Mixer", 0)
else
reaper.Main_OnCommand(40286, 0)
end

0 comments on commit 0de884e

Please sign in to comment.