Old 12-23-2015, 08:45 AM   #1201
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 7,571
Default

Quote:
Originally Posted by X-Raym View Post
@epicsounds
Hmmm Im pretty sure i have things for that... Try this
here
don't think that's it, wrong link or I explained it poorly.

edit - your script is using item left edge, not item start (snap offset).

SWS: Quantize item's start to grid (keep length) will align selected items based on their offset. But only to grid, not to markers or the cursor. Often I want to insert the cursor at a particular time then snap the items to that location.

See the action: "item edit: move position of items to edit cursor" I need that but using the item start (snap offset) instead of item edge.
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog

Last edited by EpicSounds; 12-23-2015 at 09:04 AM.
EpicSounds is offline   Reply With Quote
Old 12-23-2015, 10:30 AM   #1202
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@EpicSounds
If an action doesnt work with snap offset (like the native one you show me) use my Move selected items position left according to their snap offset script. It is meant to be use in custom action for such problems.

@gestaltito
This sounds possible.
Away from REAPER at this moment, if nobody take this, I may take a look.
X-Raym is offline   Reply With Quote
Old 12-23-2015, 12:14 PM   #1203
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by mpl View Post
If you want, I can extract function to getset offline state of given trackfx.
Thanks for your donation! I tried to do a "counter-donation" for all your work in the ReaTeam and all, but paypal.me isn't available from Finland

Here's my attempt on getting a track FX offline state:



Lua function: is_track_FX_offline(track, fx_index)
Code:
function starts_with(text,prefix)
  return string.sub(text, 1, string.len(prefix)) == prefix
end


function is_track_FX_offline(track, fx_index) -- fx_index is zero based
  if track == nil then
    return
  end
  
  if reaper.TrackFX_GetCount(track) < fx_index + 1 or fx_index < 0 then
    return
  end
  
  local ret, tr_chunk = reaper.GetTrackStateChunk(track, "", false)
  if not ret then
    return
  end
  
  local index = 0 -- fx counter
  local t = {}
  -- iterate over lines in track state chunk
  for line in tr_chunk:gmatch("[^\r\n]+") do
    -- if "BYPASS x x x" -line found (second x holds the offline state)...
    if starts_with(line, "BYPASS") then
      -- ...and the correct fx_index found
      if index == fx_index then
        -- iterate over words in "BYPASS x x x" -line
        for word in line:gmatch("%S+") do
          -- collect all words into table
          t[#t+1] = word
        end
        -- second x (table position = 3) holds the fx offline state (BYPASS x X x)
        --                                                             1    2 3 4
        local offline_state = t[3] == "1"
        return offline_state
      end
      index = index + 1
    end
  end    
end

-- Example:
--  Select track -> run the script from RS IDE
is_first_fx_offline = is_track_FX_offline(reaper.GetSelectedTrack(0,0), 0)
is_second_fx_offline = is_track_FX_offline(reaper.GetSelectedTrack(0,0), 1)
is_third_fx_offline = is_track_FX_offline(reaper.GetSelectedTrack(0,0), 2)

Last edited by spk77; 12-23-2015 at 12:22 PM.
spk77 is offline   Reply With Quote
Old 12-23-2015, 12:27 PM   #1204
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

spk77, thanks! (just note: there are also item fx and recording fx, I also didn`t look at this, but went deeply into chunk to make it editable in some way, for example parse fx in <FX_CHAIN> section only to leave item fx and recording fx)

Last edited by mpl; 12-23-2015 at 01:20 PM.
mpl is offline   Reply With Quote
Old 12-23-2015, 06:44 PM   #1205
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@gestaltito
Hi !

A chistmas gift is waiting for you in this thread:
Scripts: Items Editing (various)

X-Raym is offline   Reply With Quote
Old 12-24-2015, 03:49 AM   #1206
Mogwai
Human being with feelings
 
Mogwai's Avatar
 
Join Date: Dec 2014
Posts: 52
Default

Would there be a script for action to toggle FX bypass in a floating window? This is not possible via standard Reaper actions, right?

See: http://forum.cockos.com/showthread.php?t=170315
Mogwai is offline   Reply With Quote
Old 12-24-2015, 03:55 AM   #1207
gestaltito
Human being with feelings
 
Join Date: Sep 2009
Posts: 14
Default

Quote:
Originally Posted by X-Raym View Post
@gestaltito
Hi !

A chistmas gift is waiting for you in this thread:
Scripts: Items Editing (various)

Oooh so cool!
Thanks a lot and Merry Xmas!
gestaltito is offline   Reply With Quote
Old 12-24-2015, 05:20 AM   #1208
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Mogwai View Post
Would there be a script for action to toggle FX bypass in a floating window? This is not possible via standard Reaper actions, right?

See: http://forum.cockos.com/showthread.php?t=170315
Maybe something like this:




(Lua script)
Code:
function toggle_bypass_for_last_focused_floating_track_fx()
  local retval, track_number, item_number, fx_number = reaper.GetFocusedFX()
  if retval == 1 and item_number == -1 then
    track = reaper.CSurf_TrackFromID(track_number, false)
    local is_open = reaper.TrackFX_GetOpen(track, fx_number)
    if is_open then
      -- toggle bypass state
      reaper.TrackFX_SetEnabled(track, fx_number, not reaper.TrackFX_GetEnabled(track, fx_number))
    end
  end
end

toggle_bypass_for_last_focused_floating_track_fx()

Last edited by spk77; 12-25-2015 at 07:27 AM. Reason: global -> local
spk77 is offline   Reply With Quote
Old 12-24-2015, 06:12 AM   #1209
Mogwai
Human being with feelings
 
Mogwai's Avatar
 
Join Date: Dec 2014
Posts: 52
Default

You definitely rock. Works like charm!



Thanks and Merry Christmas!

Last edited by Mogwai; 12-24-2015 at 06:13 AM. Reason: Christmas
Mogwai is offline   Reply With Quote
Old 12-24-2015, 11:46 AM   #1210
ericzang
Human being with feelings
 
ericzang's Avatar
 
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 488
Default

Nice script! On the topic of fx bypass, I am often using the dry/wet control as a "soft bypass" on plugins that cause glitches when the bypass box is clicked (nebula in particular often causes big glitches).

A soft bypass script has been written in python, but unfortunately I am among those for whom python will not be recognized by my Reaper install.

Python script and description here:
http://forum.cockos.com/showthread.p...ht=soft+bypass

For a work around, currently I have a midi controller linked to the action:
adjust last touched fx parameter.
Of course, this requires one to click the dry wet knob before using, and remember to do so after making any other fx parameter adjustments.

Might a similar soft bypass script be relatively easy to create?
ericzang is offline   Reply With Quote
Old 12-24-2015, 12:42 PM   #1211
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Mogwai View Post
You definitely rock. Works like charm!



Thanks and Merry Christmas!
Glad it worked! Merry Christmas!

Quote:
Originally Posted by ericzang View Post
Nice script! On the topic of fx bypass, I am often using the dry/wet control as a "soft bypass" on plugins that cause glitches when the bypass box is clicked (nebula in particular often causes big glitches).

A soft bypass script has been written in python, but unfortunately I am among those for whom python will not be recognized by my Reaper install.

Python script and description here:
http://forum.cockos.com/showthread.p...ht=soft+bypass

For a work around, currently I have a midi controller linked to the action:
adjust last touched fx parameter.
Of course, this requires one to click the dry wet knob before using, and remember to do so after making any other fx parameter adjustments.

Might a similar soft bypass script be relatively easy to create?
Thanks! There's this Lua function...

Code:
Lua: reaper.get_action_context()

Returns contextual information about the script, typically MIDI/OSC input values:
is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()

val will be set to a relative or absolute value depending on mode (=0: absolute mode, >0: relative modes). resolution=127 for 7-bit resolution, =16383 for 14-bit resolution.
Notes: sectionID, and cmdID will be set to -1 if the script is not part of the action list. mode, resolution and val will be set to -1 if the script was not triggered via MIDI/OSC.
... it might be possible to directly link a MIDI controller to f.ex. dry/wet knob on any floating/last focused track FX.

The problem is that I don't have a MIDI controller - I can't do any testing

Could you or someone else test this script (save as somescriptname.lua):
  • load the script into the action list
  • add shortcut (by turning a knob on MIDI controller)
  • run the script to see the values the script is "receiving"
Code:
function msg(m)
  return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()
msg("is_new_value: " .. tostring(is_new_value))
msg("mode: " .. tostring(mode))
msg("resolution: " .. tostring(resolution))
msg("val: " .. tostring(val))
msg(" ")
spk77 is offline   Reply With Quote
Old 12-24-2015, 01:17 PM   #1212
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,241
Default

happy holidays spk77!

is_new_value: true
mode: 0
resolution: 127
val: 23

val goes from 0 to 127 as I move the knob in the midi controller. that's assigning Absolute mode

In Relative 1 it's different. from 1 to 64 (from min in the knob to middle) and then -64 to -1 (from middle to max in the knob)

Relative 2: from -63 to 63 (all the range)

Relative 3: 1 to 63 and 0 to -63

Last edited by heda; 12-24-2015 at 01:23 PM.
heda is offline   Reply With Quote
Old 12-24-2015, 01:37 PM   #1213
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by heda View Post
happy holidays spk77!

is_new_value: true
mode: 0
resolution: 127
val: 23

val goes from 0 to 127 as I move the knob in the midi controller. that's assigning Absolute mode

In relative it's different. from 1 to 64 (from min in the knob to middle) and then -64 to -1 (from middle to max in the knob)
Happy holidays, heda!

Hmmm...so those values should be scaled to 0...1 (I guess dry/wet param value goes from 0 to 1 - haven't tested).
But which one should we use: absolute or relative mode? Then there's also a "Soft takeover" (checkbox) for the absolute mode...
spk77 is offline   Reply With Quote
Old 12-24-2015, 11:16 PM   #1214
ericzang
Human being with feelings
 
ericzang's Avatar
 
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 488
Default

Thanks so much for checking this out Spk77!

Yes, I get the same results as Heda.

You can simulate a midi controller. First use a virtual midi port, such as:
http://www.tobias-erichsen.de/software/loopmidi.html

Probably you understand how to do all this, but as you don't have a midi controller, I'll describe the steps just in case.

In Reaper Preferences > MIDI Devices, make sure loopmidi is Enabled+Control in the Input window, and Enabled in the Output.

Then on a Reaper track, set its midi output to the loopmidi driver.

insert ReaControlMIDI.
In its Control Change section check on "Enable" & "Raw mode"

Now you can move a slider and Reaper will see it as an incoming midi control message. You can set a shortcut to the action.
ericzang is offline   Reply With Quote
Old 12-25-2015, 07:13 AM   #1215
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by ericzang View Post
Thanks so much for checking this out Spk77!

Yes, I get the same results as Heda.

You can simulate a midi controller. First use a virtual midi port, such as:
http://www.tobias-erichsen.de/software/loopmidi.html

Probably you understand how to do all this, but as you don't have a midi controller, I'll describe the steps just in case.

In Reaper Preferences > MIDI Devices, make sure loopmidi is Enabled+Control in the Input window, and Enabled in the Output.

Then on a Reaper track, set its midi output to the loopmidi driver.

insert ReaControlMIDI.
In its Control Change section check on "Enable" & "Raw mode"

Now you can move a slider and Reaper will see it as an incoming midi control message. You can set a shortcut to the action.
Thanks, it worked!

(I still had to use parameter modulation (for testing): If I move a slider on the ReaControlMIDI, it becomes "last focused FX" and the script doesn't work )



Here's the first attempt:

Lua - Adjust wet parameter of floating and focused track FX.
Code:
function msg(m)
  return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

function adjust_wet_param()
  local is_new_value, filename, sectionID, cmdID,mode, resolution, val = reaper.get_action_context()
  local retval, track_number, item_number, fx_number = reaper.GetFocusedFX()
  if retval == 1 and item_number == -1 then -- this script works only on track FXs
    local track = reaper.CSurf_TrackFromID(track_number, false)
    local is_open = reaper.TrackFX_GetOpen(track, fx_number)
    if not is_open then
      return
    end
    for i=1, reaper.TrackFX_GetNumParams(track, fx_number) do
      local ret, param_name = reaper.TrackFX_GetParamName(track, fx_number, i-1, "")
      --msg(param_name)
      if param_name == "Wet" then
        --msg(val/127)
        reaper.TrackFX_SetParam(track, fx_number, i-1, val/127)
        break
      end
    end
  end
end

reaper.defer(adjust_wet_param)

Last edited by spk77; 12-25-2015 at 11:20 AM. Reason: global variables to local
spk77 is offline   Reply With Quote
Old 12-25-2015, 08:21 AM   #1216
Alex Philipp
Human being with feelings
 
Alex Philipp's Avatar
 
Join Date: Mar 2015
Posts: 52
Default Request

Hi, guys!
Im mapping my dream controller with PXT and Push1.
I want to set knobs to control volume of sends, so it could be done with
- Adjust track send No .....
But if no send exist it doesnt work. So my question if it possible to make script that create send to track 1 with FX if it (send) not exist, else just send volume control.
And also for tracks 2,3,4,5?

Thank You for Your good job here!

Merry Christmas!
Alex Philipp is offline   Reply With Quote
Old 12-25-2015, 10:10 AM   #1217
ericzang
Human being with feelings
 
ericzang's Avatar
 
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 488
Default

Wow thanks so much Spk77, this is really great! I'll be using this all the time!

All the Scripters are so generous, a big part of what makes REAPER great! Let's all remember to donate, even if only a little bit, but from a lot of us can add up.
ericzang is offline   Reply With Quote
Old 12-25-2015, 10:15 AM   #1218
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by ericzang View Post
Wow thanks so much Spk77, this is really great! I'll be using this all the time!

All the Scripters are so generous, a big part of what makes REAPER great! Let's all remember to donate, even if only a little bit, but from a lot of us can add up.
Glad it worked and thanks for your donation!
spk77 is offline   Reply With Quote
Old 12-25-2015, 11:53 AM   #1219
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Alex Philipp View Post
Hi, guys!
Im mapping my dream controller with PXT and Push1.
I want to set knobs to control volume of sends, so it could be done with
- Adjust track send No .....
But if no send exist it doesnt work. So my question if it possible to make script that create send to track 1 with FX if it (send) not exist, else just send volume control.
And also for tracks 2,3,4,5?

Thank You for Your good job here!

Merry Christmas!
Hi and Merry Christmas!

It's possible to...
  • control volume of track sends
  • add tracks
  • add FXs to tracks
  • manipulate track routing (add sends/receives to existing tracks)
...from reascripts



But I'm not sure if I understood your request, sorry .
Should it create new tracks or just a new send from "source track" to an existing track?

I guess there should be 5 scripts?
spk77 is offline   Reply With Quote
Old 12-25-2015, 12:27 PM   #1220
Alex Philipp
Human being with feelings
 
Alex Philipp's Avatar
 
Join Date: Mar 2015
Posts: 52
Default

Quote:
Originally Posted by spk77 View Post
Hi and Merry Christmas!

It's possible to...
  • control volume of track sends
  • add tracks
  • add FXs to tracks
  • manipulate track routing (add sends/receives to existing tracks)
...from reascripts



But I'm not sure if I understood your request, sorry .
Should it create new tracks or just a new send from "source track" to an existing track?

I guess there should be 5 scripts?
I always have 5 first tracks as my FX receivers with different FXs, so I want send to one of them from another track and control of volume with one of 5 knobs for each send. There is action for control send volume, but send routing itself need to be created first. I want set action for one (first for example) knob so, when I turn knob it first check if that send to first track exist on selected track, if not, it create it, else just control that send volume amount. And I need that for tracks No 1,2,3,4,5
Hope that clear.

I talk about creating routing, but not tracks.

Last edited by Alex Philipp; 12-25-2015 at 12:36 PM.
Alex Philipp is offline   Reply With Quote
Old 12-25-2015, 01:26 PM   #1221
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Thanks for the explanation.

Testing...
Create a new send to track 1 (if it doesn't exist) or just control the send volume:

spk77 is offline   Reply With Quote
Old 12-25-2015, 01:29 PM   #1222
Alex Philipp
Human being with feelings
 
Alex Philipp's Avatar
 
Join Date: Mar 2015
Posts: 52
Default

Quote:
Originally Posted by spk77 View Post
Thanks for the explanation.

Testing...
Create a new send to track 1 (if it doesn't exist) or just control the send volume:

Awesome! Works exactly as I want!
Alex Philipp is offline   Reply With Quote
Old 12-25-2015, 01:36 PM   #1223
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Nice! I'll post the scripts when/if I manage to finish them
spk77 is offline   Reply With Quote
Old 12-26-2015, 06:11 AM   #1224
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Alex Philipp,

I hope this works...I didn't (couldn't) test it thoroughly.
  • make 5 copies of this script (see the gif)
  • change the "track number" for each script (first line in the script)
  • the "track number" here means "receiving track"



This Lua script "template" adjusts or creates a send to track 1
Code:
local track_number = 1 -- change the number (number = receiving track number)

function msg(m)
  return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

-- "Smoothing/scaling" functions
--local vol_to_slider = function (vol) return (vol*4)^(1/4) end
local slider_to_vol = function (slider_val) return slider_val^4/4 end


function has_send_to_track(sending_track, receiving_track)
  local has_send = false
  local send_index = nil
  if sending_track == nil or receiving_track == nil then
    return
  end
  
  local num_sends = reaper.GetTrackNumSends(sending_track, 0)
  local num_hw_outs = reaper.GetTrackNumSends(sending_track, 1)

  for i=1, num_sends do
    local dest_track = reaper.BR_GetMediaTrackSendInfo_Track(sending_track, 0, i-1, 1)
    if dest_track == receiving_track then
      send_index = num_hw_outs + i-1 
      has_send = true
      break
    end
  end
  return has_send, send_index
end


function adjust_or_create_send_to_track(track_number)
  local is_new_value, filename, sectionID, cmdID,mode, resolution, val = reaper.get_action_context()
  local track = reaper.CSurf_TrackFromID(track_number, false)
  if track == nil then
    return
  end

  local sel_track = reaper.GetSelectedTrack(0, 0) -- source track
  if sel_track == nil then
    return
  end
  
  local has_send, send_index = has_send_to_track(sel_track, track)

  if not has_send then
    reaper.SNM_AddReceive(sel_track, track, -1)
  else  
    reaper.SetTrackSendUIVol(sel_track, send_index, slider_to_vol(2*val/127), 0)
  end
end

function main()
  adjust_or_create_send_to_track(track_number)
end

reaper.defer(main)
spk77 is offline   Reply With Quote
Old 12-26-2015, 07:24 AM   #1225
Alex Philipp
Human being with feelings
 
Alex Philipp's Avatar
 
Join Date: Mar 2015
Posts: 52
Default

@spk77 Thank a lot! It works exactly as I want!
Alex Philipp is offline   Reply With Quote
Old 12-26-2015, 07:58 AM   #1226
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Glad it worked!



I don't know how the "MIDI input val" to "send vol" should be scaled, but this is how I'm doing it:


1) Return value of this function is passed to SetTrackSendUIVol:
Code:
local slider_to_vol = function (slider_val) return slider_val^4/4 end
slider_val range = 0 to 2


2) reaper.SetTrackSendUIVol sets the send volume:
Code:
reaper.SetTrackSendUIVol(sel_track, send_index, slider_to_vol(2*val/127), 0)
val: MIDI input value (0 to 127)
slider_to_vol(2*val/127) returns values from 0 to 4 (-inf to +12dB)

Last edited by spk77; 12-26-2015 at 08:49 AM. Reason: slider_val range = 0 to 2
spk77 is offline   Reply With Quote
Old 12-26-2015, 08:13 AM   #1227
Alex Philipp
Human being with feelings
 
Alex Philipp's Avatar
 
Join Date: Mar 2015
Posts: 52
Default

Quote:
Originally Posted by spk77 View Post
Glad it worked!



I don't know how the "MIDI input val" to "send vol" should be scaled, but this is how I'm doing it:


1) Return value of this function is passed to SetTrackSendUIVol:
Code:
local slider_to_vol = function (slider_val) return slider_val^4/4 end
slider_val range = 0 to 2 (-inf to +12dB)


2) reaper.SetTrackSendUIVol sets the send volume:
Code:
reaper.SetTrackSendUIVol(sel_track, send_index, slider_to_vol(2*val/127), 0)
val: MIDI input value (0 to 127)
Everything as it should be! Midi CC sends 0-127 in absolute mode.
Thank You one more time!
Alex Philipp is offline   Reply With Quote
Old 12-26-2015, 08:26 AM   #1228
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Ok, I'm still glad it works

(Edited my last post: slider_val range = 0 to 4 not 0 to 2)

Edit2:
slider_val range = 0 to 2

slider_to_vol(2*val/127) returns values from 0 to 4

Last edited by spk77; 12-26-2015 at 08:50 AM.
spk77 is offline   Reply With Quote
Old 12-27-2015, 10:37 AM   #1229
Mogwai
Human being with feelings
 
Mogwai's Avatar
 
Join Date: Dec 2014
Posts: 52
Default

Any approach for the problem in this thread?

http://forum.cockos.com/showthread.php?t=170449

Thanks...
Mogwai is offline   Reply With Quote
Old 12-27-2015, 12:00 PM   #1230
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Mogwai View Post
Any approach for the problem in this thread?

http://forum.cockos.com/showthread.php?t=170449

Thanks...
Locking the rec arm of the tuner track would be possible, I guess, but it would need a script running in the background.


Here's a Lua script "template" for creating a send:

Create send to track named X (X is a predefined track name)
Code:
-- This Lua script template creates a send from selected track
-- to a track which name is SEND 1
local track_name = "SEND 1" -- Set receiving track's name here

function has_send_to_track(sending_track, receiving_track)
  local has_send = false
  local send_index = nil
  if sending_track == nil or receiving_track == nil then
    return
  end
  
  local num_sends = reaper.GetTrackNumSends(sending_track, 0)
  local num_hw_outs = reaper.GetTrackNumSends(sending_track, 1)

  for i=1, num_sends do
    local dest_track = reaper.BR_GetMediaTrackSendInfo_Track(sending_track, 0, i-1, 1)
    if dest_track == receiving_track then
      send_index = num_hw_outs + i-1
      has_send = true
      break
    end
  end
  return has_send, send_index
end


function create_send_to_track(track_name)
  local sel_track = reaper.GetSelectedTrack(0, 0) -- source track
  if sel_track == nil then
    return
  end
  local send_track_index = -1
  local send_track_id = nil
  for i=1, reaper.CountTracks(0) do
    local track = reaper.GetTrack(0, i-1)
    if track ~= nil then
      local ret, this_track_name = reaper.GetSetMediaTrackInfo_String(track, "P_NAME", "", false)
      if ret and this_track_name == track_name then
        send_track_index = i-1
        send_track_id = track -- destination track
        break
      end
    end
  end
  
  local has_send, send_index = has_send_to_track(sel_track, send_track_id)

  -- create send if not already created
  if send_track_index > - 1 and not has_send then
    reaper.SNM_AddReceive(sel_track, send_track_id, -1)
    reaper.Undo_OnStateChangeEx("Create send", -1, -1)
  end
end

function main()
  create_send_to_track(track_name)
end

reaper.defer(main)
spk77 is offline   Reply With Quote
Old 12-27-2015, 12:20 PM   #1231
Mogwai
Human being with feelings
 
Mogwai's Avatar
 
Join Date: Dec 2014
Posts: 52
Default

Quote:
Originally Posted by spk77 View Post
Here's a Lua script "template" for creating a send:
Thanks! That's an useful script for other purposes too!
I think I'll make some shortcuts for creating reverbs and their sends, etc.

For the tuner purpose I changed the line

Quote:
reaper.SNM_AddReceive(sel_track, send_track_id, -1)
to

reaper.SNM_AddReceive(sel_track, send_track_id, 1)

And now the script creates the send pre-fx...
For the rest of the code it's bit hard to follow but maybe some day
Mogwai is offline   Reply With Quote
Old 12-27-2015, 12:32 PM   #1232
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Mogwai,

"Create send to track named X" was a nice idea, so thanks to you too
spk77 is offline   Reply With Quote
Old 12-30-2015, 03:43 AM   #1233
gestaltito
Human being with feelings
 
Join Date: Sep 2009
Posts: 14
Default

Hi again!
Couple suggestions that landed in my mind today:
"Move item position of selected item to start of next region according to ripple state"? (I think sometimes "selected" can be more useful than "under mouse")...
Also regarding "Quantize selected items to closest region start", could this as well be "according to ripple state"? (Otherwise, when trying this on a string of splitted items, these overlap)
Cheers and a happy 2016!

Last edited by gestaltito; 12-30-2015 at 03:53 AM.
gestaltito is offline   Reply With Quote
Old 12-30-2015, 06:32 AM   #1234
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
Also regarding "Quantize selected items to closest region start", could this as well be "according to ripple state"?
I don't thinks this behavior is suitable for this particular script,
because of the simple fact that it allows to select multiple items on a same track, that will move differently (and then, it will be hard to guess what length for the riple editing is suited).

Something like "ripple edit non selected items according the previous quantized items on the same track" could be imagine in a mod of this script, but this would be a very very specific kind of workflow, and would take a certain of time to put in place.

Maybe a better idea would be to think "group items" rather than thinking (ripple editing).
I always (almost) group split items to not loose the relative timing.

Hmmm.... There is not groups related functions in the API... The only thing we can do is "see/set one item group"...
Everything have to be built on this. We have to be clever and find ways to check if an item is in group (and determine on which items it is linked), in a performance friendly way.
Also find a way to prevent moving an item if he already moved.

EDIT: Ok I think I have an idea. Just store a new entry in a table when a items has a group. When checking items groups, just check if an entry for this group exist in the table. If yes, quantize, if not, don't quantize. Faster than put every items in multi dimensional table.
To handle not selected items in group, an extra loop (checking all items in the project) would have to be done. I don't know how well it can perform on big project but it can be correct.
A bit of research on how groups are handle is necessary to determine if all this is possible.
X-Raym is offline   Reply With Quote
Old 12-30-2015, 07:30 AM   #1235
gestaltito
Human being with feelings
 
Join Date: Sep 2009
Posts: 14
Default

I guess all this moves into complex territory, thanks 4 giving it some thinking...
Thanks again anyway, since though I'm still in the "moving one item after the other" stage, I've saved lots of mouse action and time with two of your scripts, "go to start of next region" and "move item position of item..." (I've attached a bit of my usual workflow).
Cheers!
Attached Images
File Type: png Project.png (9.4 KB, 399 views)
gestaltito is offline   Reply With Quote
Old 12-30-2015, 08:12 AM   #1236
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@gestaltito
I'll take a look anyway, I also think that scripts that move items should preserve grouping (and relative item distance), so I will take a look.

Stay tuned !
X-Raym is offline   Reply With Quote
Old 12-30-2015, 09:52 AM   #1237
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@gestaltito

I think you can re-download my script pack, I just updated Quantize selected items to closest region start
Edit: also updated the marker version of it.
Code:
 * v1.1 (2015-12-24)
   + Preserve relative position of items in groups (considering min pos of selected items in groups as referance, and propagate offset on al items in groups, even non selected ones.
Tell me what do you think of that :P

Last edited by X-Raym; 12-30-2015 at 09:57 AM.
X-Raym is offline   Reply With Quote
Old 01-03-2016, 05:36 AM   #1238
gestaltito
Human being with feelings
 
Join Date: Sep 2009
Posts: 14
Default

Quote:
Originally Posted by X-Raym View Post
@gestaltito

I think you can re-download my script pack, I just updated Quantize selected items to closest region start
Edit: also updated the marker version of it.
Code:
 * v1.1 (2015-12-24)
   + Preserve relative position of items in groups (considering min pos of selected items in groups as referance, and propagate offset on al items in groups, even non selected ones.
Tell me what do you think of that :P
This is so great!! Tomorrow morning I'll give it a go and I'll keep you posted, many thanks!
gestaltito is offline   Reply With Quote
Old 01-03-2016, 09:38 AM   #1239
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 7,571
Default

Can I get something to move the cursor by frame grid left and right? The built-in move cursor by grid size is unfortunately linked to zoom level.

For video editing I need to move the cursor a frame at a time without zooming in first.
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
EpicSounds is offline   Reply With Quote
Old 01-03-2016, 10:41 AM   #1240
Subz
Human being with feelings
 
Subz's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 3,210
Default

detect BPM of an audio file? (like they have in DJ Software)

[so not via length but via transient spacing] (or however it would be worked out)

i am new to scripts so expect some more of these from me!

and as i am new many may be redundant!

so please be kind to me!

Subz
Subz 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 05:39 AM.


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