-
Notifications
You must be signed in to change notification settings - Fork 0
/
resize tracks to fit screen height.lua
26 lines (22 loc) · 1.12 KB
/
resize tracks to fit screen height.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
------------------------------------------
--- RESIZE TRACKS TO FIT SCREEN HEIGHT ---
------------------------------------------
-- Increase/decrease below pad-variable --
-- to calibrate it to your liking. --
------------------------------------------
local set_this_pad_to_your_liking = 0
------------------------------------------
------------------------------- CODE THAT DOES THE DEED. -------------------------------
set_this_pad_to_your_liking = set_this_pad_to_your_liking + 250 -- add ~space of UI
local n_tracks = reaper.CountTracks(0)
local _, _, w, h = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 1) -- Closest thing to documentation here: https://forum.cockos.com/showpost.php?p=1883879&postcount=4
local track_size = (h - set_this_pad_to_your_liking) / n_tracks
local track
for i=1, n_tracks, 1 do
track = reaper.GetTrack(0, i-1)
local previously_selected = reaper.IsTrackSelected(track)
reaper.SetTrackSelected(track, true)
reaper.SetMediaTrackInfo_Value(track, "I_HEIGHTOVERRIDE", track_size)
if not previously_selected then reaper.SetTrackSelected(track, false) end
end
reaper.TrackList_AdjustWindows(false)