Skip to content

Commit b51dfa0

Browse files
authored
Release Minimize all track envelopes 1.0 (Initial Release) (#1410)
1 parent 87f9ebf commit b51dfa0

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--[[
2+
@description Minimize all track envelopes
3+
@version 1.0
4+
@author Ben 'Talagan' Babut
5+
@license MIT
6+
@donation
7+
https://www.paypal.com/donate/?business=3YEZMY9D6U8NC&no_recurring=1&currency_code=EUR
8+
@changelog
9+
- Initial release
10+
@about
11+
This script simply minimizes all track envelopes (it sets their heights to their minimum)
12+
--]]
13+
14+
local function perform()
15+
16+
-- Modifying the envelope state chunk does not allow to have an undo entry
17+
-- ... so undo is not possible, it seems. Let's still handle it as we should.
18+
reaper.Undo_BeginBlock();
19+
20+
-- Loop on all tracks
21+
local tn = reaper.CountTracks(0);
22+
local ti = 0
23+
for ti = 0, tn-1, 1 do
24+
local track = reaper.GetTrack(0,ti);
25+
local en = reaper.CountTrackEnvelopes(track);
26+
27+
-- Loop on each envelope for the current track
28+
for ei = 0, en-1, 1 do
29+
local evl = reaper.GetTrackEnvelope(track, ei);
30+
31+
-- ... and patch the height through the state chunk
32+
_, str = reaper.GetEnvelopeStateChunk(evl, "", false);
33+
str = str:gsub("\nLANEHEIGHT %d+ %d+\n", "\nLANEHEIGHT 0 0\n");
34+
reaper.SetEnvelopeStateChunk(evl,str);
35+
end
36+
end
37+
38+
reaper.Undo_EndBlock("Minimized all track envelopes",-1);
39+
end
40+
41+
perform()

0 commit comments

Comments
 (0)