View Single Post
Old 07-07-2017, 11:35 AM   #26
Human being with feelings
mpl's Avatar
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,463

Don Solaris,
didn`t heard about any issues with this script (it almost doesnt touch any possible win/osx differences, I`m on windows) and about mentioned issues with listing samples in RS5K.

Maybe I didn`t named it properly (as usual, unfortunately my English is still bad). "List next/previous sample in directory for RS5k" was designed to list samples for RS5k instance on selected track (like you play and hear arrange and list samples without actual opening track FX chain and selecting RS5k instance). In case you want to replace native function seems you need different script. You can test this piece of code below. If it works for you, I can make version for ReaPack for assigning with shortcut or mousewheel (but bug report to Justin or Schwa of course better).

(test_List next sample for focused RS5k)
  function main()
    local ret, tracknumberOut, _, fxnumberOut = reaper.GetFocusedFX()
    local track = reaper.CSurf_TrackFromID( tracknumberOut, false )
    if not track then return end
    ret, fn = reaper.TrackFX_GetNamedConfigParm(track, fxnumberOut, "FILE0")
    if not ret then return end
    fn = fn:gsub('\\', '/')
    path = fn:reverse():match('[%/]+.*'):reverse():sub(0,-2)
    cur_file =     fn:reverse():match('.-[%/]'):reverse():sub(2)
    -- get files list
      local files = {}
      local i = 0
      local file = reaper.EnumerateFiles( path, i )
      if file then
        files[#files+1] = file
      i = i+1
      until file == nil
    -- search file list
      local trig_file
      if #files < 2 then return end
      for i = 2, #files do
        if files[i-1] == cur_file then trig_file = path..'/'..files[i] break end
      if trig_file then 
        reaper.TrackFX_SetNamedConfigParm(track, fxnumberOut, "FILE0", trig_file)
        reaper.TrackFX_SetNamedConfigParm(track, fxnumberOut, "DONE", "")

  reaper.Undo_EndBlock('test_Next focused RS5k smpl', 1)
SoundCloud | MPL Scripts discussion | ReaPack | Donate

Last edited by mpl; 08-01-2017 at 11:25 PM.
mpl is offline   Reply With Quote