Old 07-22-2019, 03:30 PM   #1
old_edge
Human being with feelings
 
Join Date: Mar 2017
Posts: 9
Default Script for making Resample Tracks for selected tracks

Hey Community,

I never used Script before and I don't know the syntax of the used script language.

I'm wondering if it is possible and if somebody is willing to write me the script or give me a set of puzzles I only have to put together.

I want to select some tracks and maybe push a button. Then I want to get newly created tracks under each selected track. Every newly created track should receive a send from the respective selected track. In the best case the newly created tracks should also get a suitable name right away.
Then for each newly created track I would like the Record options to be on "Output: stereo".
Finally only every newly created track should be armed and ready for resampling.

Is this possible and/or overly complicated and in either or both cases does somebody want to help me with this?

Thank you in advance and sorry if I sound rude accidently. I'm writing this in a zombie-super-sleepy state. No arrogance or anything intended!

Happy day
old_edge
old_edge is offline   Reply With Quote
Old 07-22-2019, 09:33 PM   #2
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,524
Default

lua:
Code:
  local defsendvol = ({reaper.BR_Win32_GetPrivateProfileString( 'REAPER', 'defsendvol', '0',  reaper.get_ini_file() )})[2]
  local defsendflag = ({reaper.BR_Win32_GetPrivateProfileString( 'REAPER', 'defsendflag', '0',  reaper.get_ini_file() )})[2]
    
  function main()
      for i = 1, reaper.CountSelectedTracks(0) do
        local tr = reaper.GetSelectedTrack(0,i-1)
        if tr then 
          
          _, src_name = reaper.GetSetMediaTrackInfo_String( tr, 'P_NAME', '',false )
          reaper.InsertTrackAtIndex( reaper.CSurf_TrackToID( tr, false ), true )
          new_dest_tr =  reaper.CSurf_TrackFromID( reaper.CSurf_TrackToID( tr, false )+1, false )
          reaper.SetMediaTrackInfo_Value( new_dest_tr, 'I_RECARM', 1 )
          reaper.SetMediaTrackInfo_Value( new_dest_tr, 'I_RECMODE', 3 )
            
          new_send_id = reaper.CreateTrackSend( tr, new_dest_tr)
          if new_send_id >= 0 then
            new_name = src_name..' Send 1'
            if new_dest_tr then
              reaper.GetSetMediaTrackInfo_String( new_dest_tr, 'P_NAME', new_name ,true)
              reaper.SetTrackSendInfo_Value( tr, 0, new_send_id, 'D_VOL', defsendvol)
              reaper.SetTrackSendInfo_Value( tr, 0, new_send_id, 'I_SENDMODE', defsendflag)
            end
          end
        end
    end
      reaper.TrackList_AdjustWindows( false )
  end
  
  main()
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 07-22-2019, 11:01 PM   #3
old_edge
Human being with feelings
 
Join Date: Mar 2017
Posts: 9
Default

wow thank you!

Unfortunately I get this error:

Resampletracks.lua:1: attempt to call a nil value (field 'BR_Win32_GetPrivateProfileString')

Do you know why this happened and how to fix it?
old_edge is offline   Reply With Quote
Old 07-23-2019, 03:04 AM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,524
Default

SWS extension must be installed to make it working.
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 07-23-2019, 04:40 AM   #5
old_edge
Human being with feelings
 
Join Date: Mar 2017
Posts: 9
Default

Wow it works thank you. Impressing!

Only thing I forgot: It would be also very nice, if the selected tracks' master sends would be deactivated. Could you tell me how to put that in the code as well?

Thanks Veeeeery much!
old_edge is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.