Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Snapshooter v1.4 #1467

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions Envelopes/tilr_Snapshooter.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
-- @description Snapshooter
-- @author tilr
-- @version 1.3
-- @version 1.4
-- @changelog
-- Increate number of snapshots to 120
-- Add snapshot pagination
-- Fix initial vol/pan/mute write if envelopes have not been created yet
-- Write all parameters function
-- Last applied snapshot indicator
-- Fix nasty bug where snapshots tracks were identified by userdata.
-- This caused failure to find the tracks on reaper restart.
-- Fixed by using tracks GUID instead.
-- @provides
-- tilr_Snapshooter/rtk.lua
-- [main] tilr_Snapshooter/tilr_Snapshooter apply snap 1.lua
Expand Down Expand Up @@ -117,11 +115,12 @@ function makesnap()
for i = 0, numtracks - 1 do
-- vol,send,mute
local tr = reaper.GetTrack(0, i)
local guid = reaper.GetTrackGUID(tr)
local ret, vol, pan = reaper.GetTrackUIVolPan(tr)
local ret, mute = reaper.GetTrackUIMute(tr)
table.insert(entries, { tr, 'Volume', vol })
table.insert(entries, { tr, 'Pan', pan })
table.insert(entries, { tr, 'Mute', mute and 1 or 0 })
table.insert(entries, { guid, 'Volume', vol })
table.insert(entries, { guid, 'Pan', pan })
table.insert(entries, { guid, 'Mute', mute and 1 or 0 })
-- sends
local sendcount = {} -- aux send counter
for send = 0, reaper.GetTrackNumSends(tr, 0) do
Expand All @@ -131,7 +130,7 @@ function makesnap()
local ret, smute = reaper.GetTrackSendUIMute(tr, send)
key = tostring(src)..tostring(dst)
count = sendcount[key] and sendcount[key] + 1 or 1
table.insert(entries, { tr, 'Send', count, key, svol, span, smute and 1 or 0 })
table.insert(entries, { guid, 'Send', count, key, svol, span, smute and 1 or 0 })
sendcount[key] = count
end
-- fx params
Expand All @@ -141,7 +140,7 @@ function makesnap()
paramcount = reaper.TrackFX_GetNumParams(tr, j)
for k = 0, paramcount - 1 do
param = reaper.TrackFX_GetParam(tr, j, k)
table.insert(entries, { tr, fxid , k, param })
table.insert(entries, { guid, fxid , k, param })
end
end
end
Expand Down Expand Up @@ -238,7 +237,7 @@ function applydiff(diff, write, tween)
-- tracks hashmap
local tracks = {}
for i = 0, numtracks - 1 do
tracks[tostring(reaper.GetTrack(0, i))] = i
tracks[reaper.GetTrackGUID(reaper.GetTrack(0, i))] = i
end
-- fxs hashmap
local fxs = {}
Expand Down Expand Up @@ -266,7 +265,7 @@ function applydiff(diff, write, tween)

-- apply diff lines
for i,line in ipairs(diff) do
tr = tracks[tostring(line[1])]
tr = tracks[line[1]]
if tr ~= nil then
local track = reaper.GetTrack(0, tr)
if not globals.ui_checkbox_seltracks or reaper.IsTrackSelected(track) then
Expand Down Expand Up @@ -394,7 +393,7 @@ function clearEnvelopesAndAddStartingPoint(diff, starttime, endtime)
local tracks = {}
local numtracks = reaper.GetNumTracks()
for i = 0, numtracks - 1 do
tracks[tostring(reaper.GetTrack(0, i))] = i
tracks[reaper.GetTrackGUID(reaper.GetTrack(0, i))] = i
end
-- fxs hashmap
local fxs = {}
Expand All @@ -407,7 +406,7 @@ function clearEnvelopesAndAddStartingPoint(diff, starttime, endtime)
end

for i,line in ipairs(diff) do
local track = tracks[tostring(line[1])]
local track = tracks[line[1]]
if track ~= null then
track = reaper.GetTrack(0, track)
local env_count = reaper.CountTrackEnvelopes(track)
Expand Down