Dup Ver Goto 📝

IncBy

To
35 lines, 152 words, 1260 chars Page 'IncBy' does not exist.

I came up with this (also at https://gist.github.com/johnallsup/f...4fc0dfa92535ca)

inc_last_touched_param.lua

function inc_last_touched(rel)
  local retval, tracknumber, fxnumber, paramnumber, val, track
  retval, tracknumber, fxnumber, paramnumber = reaper.GetLastTouchedFX()

  if retval then
    track = reaper.GetTrack(0,tracknumber-1)
    val, minval, maxval = reaper.TrackFX_GetParam(track, fxnumber, paramnumber)
    val = val + rel
    if val > maxval then
      val = maxval
    end
    if val < minval then
      val = minval
    end
    retval = reaper.TrackFX_SetParam(track,fxnumber,paramnumber,val)
  end
end

Example script to use this

-- thanks to https://gist.github.com/X-Raym/f7f6328b82fe37e5ecbb3b81aff0b744
-- for the dofile trick
local script = "inc_last_touched_param.lua"
local script_folder = debug.getinfo(1).source:match("@?(.*[\\|/])")
local script_path = script_folder .. script
dofile(script_path)
inc_last_touched(0.01)

How I use it.

I have a Python script (on a Linux laptop) that listens to a Nocturn's MIDI and sends OSC to Reaper. Thus I can touch a parameter and then turn a knob. By having multiple files with multiple granularities, different knobs give a different granularity of control.