Old 02-23-2018, 01:32 AM   #1
Arranger
Human being with feelings
 
Join Date: Mar 2017
Posts: 4
Default Is it possible with scripting?

Hi, A newbie to scripting here.

I took a look at the api but I can't find exactly what I need so I thought I would ask before I spend to much time maybe for nothing.

I would like to bypass an fx which is on a track which I would determine by its name or its position but not by being selected. Going further I need to be able to change a preset on that fx.

Here is an example of what it would look like in pseudo code to turn an effect off:

on track BASS set effect DELAY to BYPASS

Or to turn it on with a certain preset:

on track "BASS" set effect "DELAY" to "DISABLE_BYPASS" and select preset "Stereo Flanger"

If it cant be by name I would be happy with just their position. For example:

on track 5, effect 3, DISABLE_BYPASS and set preset to 2

Is it possible to do this with a script? Thanks,
Arranger is offline   Reply With Quote
Old 02-23-2018, 04:09 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

This is totally possible,

You have all functions for that:

https://www.extremraym.com/cloud/reascript-doc/

Code:
 reaper.TrackFX_GetByName( track, fxname, instantiate )
reaper.TrackFX_SetEnabled( track, fx, enabled )
 reaper.TakeFX_SetPreset( take, fx, presetname )
X-Raym is offline   Reply With Quote
Old 02-23-2018, 08:34 AM   #3
Arranger
Human being with feelings
 
Join Date: Mar 2017
Posts: 4
Default

Hey, thanks for your help. That looks exactly like what I was looking for.
Arranger is offline   Reply With Quote
Old 02-23-2018, 09:25 AM   #4
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Arranger View Post
Hi, A newbie to scripting here.

I took a look at the api but I can't find exactly what I need so I thought I would ask before I spend to much time maybe for nothing.

I would like to bypass an fx which is on a track which I would determine by its name or its position but not by being selected...
Hi, here's how to find a track by name:

Code:
function get_track_by_name(track_name_str)
  local tr_count = reaper.CountTracks(0)
  if tr_count == 0 then
    return
  end
  local tr_found = false
  for i = 1, tr_count - 1 do
    local tr = reaper.GetTrack(0, i-1)
    if tr then
      local ret, current_tr_name = reaper.GetSetMediaTrackInfo_String(tr, "P_NAME", "", false)
      if ret then
        -- 1. exact match:
        --if current_tr_name == track_name_str then
        
        -- 2. if "track_name_str" in track name (case sensitive):                
        --if current_tr_name:find(track_name_str) then
        
        -- 3. if "track_name_str" in track name (case insensitive)                  
        if current_tr_name:lower():find(track_name_str:lower()) then
          reaper.ShowConsoleMsg(track_name_str .. "-track found. Track number: " .. i .. ")\n")
          tr_found = true
          break
        end
      end
    end
    
  end
  if not tr_found then
    reaper.ShowConsoleMsg("Couldn't find " .. track_name_str .. "\n" )
  end  
end

get_track_by_name("BASS")
spk77 is offline   Reply With Quote
Old 02-24-2018, 06:28 AM   #5
Arranger
Human being with feelings
 
Join Date: Mar 2017
Posts: 4
Default

Thanks! You guys are fantastic. I got it up and running in minutes.
Arranger 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 01:51 PM.


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