Old 02-18-2019, 07:53 AM   #1
Stroudy
Human being with feelings
 
Join Date: Jul 2014
Posts: 385
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: 1,365
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: 6,029
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: 1,365
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: 6,029
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
 
Join Date: Jul 2014
Posts: 385
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
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 12:53 AM.


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