Old 04-19-2019, 04:26 PM   #1
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default How to deal with TrackFX_SetPinMappings ??

Hi, guys!
Could you help me to understand how it works..
I have several ReaSamplomatic5000 on my track

I want my 1st RS5K's output mapped to 1/2, second - 3/4 (removed default mapping to 1/2), third - 5/6 and so on

Code:
for i = 0,  reaper.TrackFX_GetCount( tr )-1 do
reaper.TrackFX_SetPinMappings( tr, i, 0, 0, 1, 0 ) --- what arguments do I pass here???
end
kartalex is offline   Reply With Quote
Old 04-19-2019, 05:18 PM   #2
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Hi kartalex,

I made this for another purpose a while back, might be what you need ?

Lua attached.
Attached Files
File Type: lua JR Set pins cascade fx rack.lua (1.2 KB, 135 views)
J Reverb is offline   Reply With Quote
Old 04-19-2019, 05:37 PM   #3
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default

Quote:
Originally Posted by J Reverb View Post
Hi kartalex,

I made this for another purpose a while back, might be what you need ?

Lua attached.
It works! Thank you! Cool!
kartalex is offline   Reply With Quote
Old 04-19-2019, 06:51 PM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Quote:
Originally Posted by J Reverb View Post
Hi kartalex,

I made this for another purpose a while back, might be what you need ?

Lua attached.
You also have to use 32bits high mask to make cascade working for channels higher than 32

Code:
function set_pins_fx_rack_1_2_cascade_in_out()

  for i = 0, reaper.CountSelectedTracks(0) - 1 do
    trk = reaper.GetSelectedTrack(0,i)

    count_fx = reaper.TrackFX_GetCount(trk)
    if count_fx ~= nil then end
    local retval,csv = reaper.GetUserInputs
    ("Cascade pins for fx from 1+2 or 3+4",1,"0 = from 1+2...1 = from 3+4...","0")
    local pins = csv:match("([^,]+)")
    pins = tonumber(pins)

    if tonumber(pins) == 0 then
      pinl=1
      pinr=2 
    end
    if tonumber(pins) ==1 then
      pinl=4
      pinr=8
    end

    rs5k_cnt = 0
    for i = 1, count_fx do
      retval,namefx = reaper.TrackFX_GetFXName(trk, i-1, '')
      if namefx:lower():match('reasamplomatic') or namefx:lower():match('rs5k') then rs5k_cnt = rs5k_cnt + 1 end
    end
    reaper.SetMediaTrackInfo_Value( trk, 'I_NCHAN', math.max(math.min(2,rs5k_cnt*2), 64))
      
      fx_cnt = 1
      for i = 1, count_fx do
        retval,namefx = reaper.TrackFX_GetFXName(trk, i-1, '')
        if namefx:lower():match('reasamplomatic') or namefx:lower():match('rs5k') and fx_cnt <= 32 then
          reaper.TrackFX_SetPinMappings(trk, i-1, 1, 0, pinl&0xFFFFFFFF,(pinl>>32)&0xFFFFFFFF) --pin l out
          reaper.TrackFX_SetPinMappings(trk, i-1, 1, 1, pinr&0xFFFFFFFF,(pinr>>32)&0xFFFFFFFF) --pin r out
          pinl=(pinl*4)
          pinr=(pinr*4)
          fx_cnt=fx_cnt+1
          if fx_cnt > 32 then break end
        end
      end
    end
  end

  set_pins_fx_rack_1_2_cascade_in_out()
mpl is offline   Reply With Quote
Old 04-19-2019, 07:24 PM   #5
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Thanks for the heads up

pinl&0xFFFFFFFF,(pinl>>32)&0xFFFFFFFF) Interesting

Presumably the match name excludes anything other than rs5k instances ?
J Reverb is offline   Reply With Quote
Old 04-19-2019, 08:53 PM   #6
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default

Quote:
Originally Posted by mpl View Post
You also have to use 32bits high mask to make cascade working for channels higher than 32
Thanks, Michael!
Quote:
Originally Posted by J Reverb
Interesting
Indeed, Lua is beautiful
kartalex 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 07:40 PM.


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