Here is a script that auto-increments the audio sends for a selected track. It found it extremely handy when I created my orchestral template. It's a hack of js_Autoincrement audio send channels of selected tracks
Notice: track audio outputs and sends must already exist before the script is launched.
Code:
--[[
* ReaScript Name: Autoincrement audio send channels of selected tracks
* Description: Autoincrements the audio send channels of selected tracks.
* Particularly useful when routing an instrument track to already existing
* (for example when creating orchestral templates)
* The audio outputs must exist before the script is launched
* The sends must already exist
* The script starts with a dialog box in which the user can select the following:
* - The starting channel from which to increment.
* - Whether to remove MIDI sends from the selected tracks, which makes the routing matrix easier to read.
* This script is a modified version of juliansader's js_Autoincrement midi send channels of selected tracks
*
* Instructions:
*
* Screenshot:
* Notes:
* Category:
* Author: juliansader
* Licence: GPL v3
* Forum Thread:
* Forum Thread URL: http://forum.cockos.com/showthread.php?t=176878
* Version: 1.1
* REAPER: 5.20
* Extensions:
]]
--[[
Changelog:
* v1.0
+ Initial Release
]]
-- USER AREA
-- Settings that the user can customize
-- End of USER AREA
---------------------------
-- Is there anything to do?
numSelTracks = reaper.CountSelectedTracks(0)
if (numSelTracks == 0)
then return(0)
end
---------------------------------------------------------------------
-- Part 1: Get user inputs (channel from which to start incrementing)
---------------------------------------------------------------------
-- Repeat until we get usable inputs
repeat
retval, userInputsCSV = reaper.GetUserInputs("Autoincrement audio send channels",
2,
"Starting channel (1-63),Remove midi sends? (y/n)",
"1,y")
if retval == false then
return(0)
else -- retval == true
gotUserInputs = true -- temporary, will be changed to false if anything is wrong
startChan, removeAudio = userInputsCSV:match("([^,]+),([^,]+)")
startChan = tonumber(startChan)
if startChan == nil or startChan < 1 or startChan > 16 then
gotUserInputs = false
end
if removeAudio ~= "y" and removeAudio ~= "Y" and removeAudio ~= "n" and removeAudio ~= "N" then
gotUserInputs = false
end
end
until gotUserInputs == true
------------------------------------------------------
-- Now autoincrement all audio sends of selected track
------------------------------------------------------
chan = startChan
selTrack = reaper.GetSelectedTrack(0, 0)
-- Iterate through all internal track sends
for sendIndex = 0, reaper.GetTrackNumSends(selTrack, 0)-1 do
reaper.SetTrackSendInfo_Value(selTrack, 0, sendIndex, "I_SRCCHAN", sendIndex*2)
-- Remove MIDI sends (I_MIDIFLAGS : -1 for none)
if removeAudio == "y" or removeAudio == "Y" then
reaper.SetTrackSendInfo_Value(selTrack, 0, sendIndex, "I_MIDIFLAGS", -1)
end
-- Increment channel
if chan == 64 then chan = 1 else chan = chan + 1 end
end -- for trackIndex = 0, numSelTracks-1