Skip to content

Commit

Permalink
Release FX chain A-B v1.04 (#1477)
Browse files Browse the repository at this point in the history
Added support for use on master track also.
  • Loading branch information
tompad2 authored Jan 7, 2025
1 parent 7553f38 commit b3045d3
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions FX/tompad_FX chain AB.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
-- @description FX chain A-B
-- @author Thomas Dahl
-- @version 1.03
-- @changelog
-- Added visual feedback on loaded A and B buttons (white border)
-- Added target platform: All (tested on Windows and Ubuntu linux)
--
-- Removed in description about copying to another track - waiting for
-- a solution on possible bug in ultraschall.SetFXStateChunk.
-- @version 1.04
-- @changelog Added support for use on master track also.
-- @about
-- # tompad_FX_chain_AB
-- Reascript for A/B-ing FX chains in Reaper DAW
Expand Down Expand Up @@ -144,7 +139,7 @@ local hbox2 = window:add(rtk.HBox{spacing=40, tmargin=170, lmargin=30})

-- Save the current FX chain to a string variable (Inject)
function saveFXChain()
local track = reaper.GetSelectedTrack(0, 0)
local track = reaper.GetSelectedTrack2(0, 0, true)
local retval1,StateChunk = reaper.GetTrackStateChunk(track,"",false)
local fx_chain, linenumber = ultraschall.GetFXStateChunk(StateChunk)
local count_of_fx= ultraschall.CountFXFromFXStateChunk(fx_chain)
Expand All @@ -157,15 +152,15 @@ end

-- Load an FX chain from a string variable
function loadFXChain(fx_chain)
local track = reaper.GetSelectedTrack(0, 0)
local track = reaper.GetSelectedTrack2(0, 0, true)
local retval1,StateChunk = reaper.GetTrackStateChunk(track,"",false)
local retval2, newStateChunk = ultraschall.SetFXStateChunk(StateChunk, fx_chain)
reaper.SetTrackStateChunk(track, newStateChunk, false)
end

-- Save the current FX chain to fx_chain1 variable
function saveFXChain1()
local antalTrack = reaper.CountSelectedTracks(0)
local antalTrack = reaper.CountSelectedTracks2(0,true)
if antalTrack == 1 then
fx_chain1 = saveFXChain()
else
Expand All @@ -175,7 +170,7 @@ end

-- Save the current FX chain to fx_chain2 variable
function saveFXChain2()
local antalTrack = reaper.CountSelectedTracks(0)
local antalTrack = reaper.CountSelectedTracks2(0,true)
if antalTrack == 1 then
fx_chain2 = saveFXChain()
else
Expand All @@ -185,7 +180,7 @@ end

-- Load the first FX chain
function loadFXChain1()
local antalTrack = reaper.CountSelectedTracks(0)
local antalTrack = reaper.CountSelectedTracks2(0, true)
if antalTrack == 1 then
if fx_chain1 == nil then
reaper.ShowMessageBox( "You need to inject a FX chain in A before you can load it!", "Error", 0)
Expand All @@ -199,7 +194,7 @@ end

-- Load the second FX chain
function loadFXChain2()
local antalTrack = reaper.CountSelectedTracks(0)
local antalTrack = reaper.CountSelectedTracks2(0, true)
if antalTrack == 1 then
if fx_chain2 == nil then
reaper.ShowMessageBox( "You need to inject a FX chain in B before you can load it!", "Error", 0)
Expand Down

0 comments on commit b3045d3

Please sign in to comment.