Old 02-18-2019, 07:53 AM   #1
Stroudy
Human being with feelings
 
Stroudy's Avatar
 
Join Date: Jul 2014
Location: London
Posts: 739
Default Input FX shortcut

Guys, are there any scripts to put plugins on the Input FX chain?

Specifically, I want to put a simple transpose MIDI JS plugin on the selected track.

Is there a way to adapt X-Raym's code here...?

Code:
--[[
 * ReaScript Name: Insert FX
 * Description: Insert FX on selected tracks. FX name is can be edited witing the script code.
 * Instructions: Run
 * Screenshot:
 * Author: X-Raym
 * Author URI: http://extremraym.com
 * Repository: GitHub > X-Raym > EEL Scripts for Cockos REAPER
 * Repository URI: https://github.com/X-Raym/REAPER-EEL-Scripts
 * File URI:
 * Licence: GPL v3
 * Forum Thread: 
 * Forum Thread URI: 
 * REAPER: 5.0
 * Extensions: None
 * Version: 1.0
--]]

reaper.Undo_BeginBlock()

FX = "Decapitator (SoundToys)"

TrackIdx = 0
TrackCount = reaper.CountSelectedTracks(0)
while TrackIdx < TrackCount do
	track = reaper.GetSelectedTrack(0, TrackIdx)
	fxIdx = reaper.TrackFX_GetByName (track, FX, 1)
	isOpen = reaper.TrackFX_GetOpen(track, fxIdx)
	if isOpen ==0 then
		isOpen = 1
	else
		isOpen = 0
		end
	reaper.TrackFX_SetOpen(track, fxIdx, isOpen)
	TrackIdx =TrackIdx+1
end

reaper.Undo_EndBlock("Insert FX Plugin",-1)
Thanks
Stroudy is offline   Reply With Quote
Old 02-18-2019, 11:16 AM   #2
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

TrackFX_AddByName should do the trick, see REAPER API documentation for more info.

Code:
-- Add FX to Input FX chain

local jsfx_filename = 'midi_transpose' -- "JS: MIDI Transpose Notes"

local track = reaper.GetSelectedTrack(0, 0)
if track then
  reaper.Undo_BeginBlock()
  local retval = reaper.TrackFX_AddByName(track, jsfx_filename, true, 1)
  if retval == -1 then reaper.MB("Failed, check filename, etc," , "ERROR", 0) end
  reaper.Undo_EndBlock("Add FX plugin to input", -1)
end

Last edited by Edgemeal; 02-18-2019 at 09:19 PM.
Edgemeal is offline   Reply With Quote
Old 02-18-2019, 02:58 PM   #3
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

CHeck in my code the line



FX = "Decapitator (SoundToys)"

This is what you need to modify. Just put the name of your FX there. Not sure for JS if you need to add JS: prefix or not.
X-Raym is offline   Reply With Quote
Old 02-18-2019, 09:17 PM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by X-Raym View Post
CHeck in my code the line



FX = "Decapitator (SoundToys)"

This is what you need to modify. Just put the name of your FX there. Not sure for JS if you need to add JS: prefix or not.
OP wants the FX on the Input FX chain.
Edgemeal is offline   Reply With Quote
Old 02-18-2019, 11:49 PM   #5
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@edgemeal
Oops, missed it ^^
X-Raym is offline   Reply With Quote
Old 02-19-2019, 05:24 AM   #6
Stroudy
Human being with feelings
 
Stroudy's Avatar
 
Join Date: Jul 2014
Location: London
Posts: 739
Default

Tremendous - thank you. I can kinda get my head around how that's working.

Any way of adding a preset into that mix? Or parameter change?

Ultimately, this is a solution to needing to transpose the MIDI keyboard to reach keyswitches and notes that extend below A-1 and above C7. Stupid 88 key keyboard doesn't transpose

Cheers

Quote:
Originally Posted by Edgemeal View Post
TrackFX_AddByName should do the trick, see REAPER API documentation for more info.

Code:
-- Add FX to Input FX chain

local jsfx_filename = 'midi_transpose' -- "JS: MIDI Transpose Notes"

local track = reaper.GetSelectedTrack(0, 0)
if track then
  reaper.Undo_BeginBlock()
  local retval = reaper.TrackFX_AddByName(track, jsfx_filename, true, 1)
  if retval == -1 then reaper.MB("Failed, check filename, etc," , "ERROR", 0) end
  reaper.Undo_EndBlock("Add FX plugin to input", -1)
end
Stroudy is offline   Reply With Quote
Old 12-31-2019, 06:09 PM   #7
themixtape
Human being with feelings
 
themixtape's Avatar
 
Join Date: Aug 2009
Posts: 1,199
Default

Thanks for this! Any way to create a Reaper Action for "toggle Input FX window"? Or even "Close Input FX" window? (You can VIEW it, but you can't CLOSE it via a shortcut).... I would LOVE to do that... thanks!
__________________
FREE copyright-safe/DMCA-safe music for Twitch/Kick streamers, classrooms, waiting rooms (playlists on all streaming platforms):
https://tinyurl.com/copyrightsafemusic

Last edited by themixtape; 12-31-2019 at 06:15 PM.
themixtape is offline   Reply With Quote
Old 12-31-2019, 06:40 PM   #8
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

reaper.TrackFX_Show(MediaTrack track, integer index, integer showFlag)


showflag=0 for hidechain, =1 for show chain(index valid), =2 for hide floating window(index valid), =3 for show floating window (index valid)
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 12-31-2019, 06:48 PM   #9
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

I think? that reaper.TrackFX_AddByName returns the index position of the added effect, if successful. I'm not at my computer right now.

If it does you can just input that number into the TrackFX_Show function.

There should be a few ways to skin this particular cat..
__________________

Support my feature request!
Dafarkias 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:21 PM.


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