Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 03-30-2018, 05:56 PM   #1
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default (SOLVED) ELL/LUA code for: Track: Insert/show reaEQ (track EQ)?

Hi guys

Not a programmer but love to learn..

Is it possible to EDIT an Action built-in Reaper by getting its code and adapting to personnal uses with the SCRIPTING fonctions?
In this case the Action called "Track: Insert/show reaEQ (track EQ)" would be used to insert my favorite Go-to EQ then assign to a keycommand shortcut.

Is it possible and if yes, how should I do it, or where should I look for help on this?

Thanks in advance
Alex


-----------------------------------------------------------------------
EDIT: I am reading and found this somewhere on Google and Forums.
https://www.reaper.fm/sdk/reascript/reascript.php

I was able to do basic stuff in ReaScript following some one else example:




reaper.Undo_BeginBlock()
-------------- (Restore before this point)

id = reaper.GetSelectedTrack(0, 0)
-------------- (Project (0 = current-project), track (0 = selected))

reaper.TrackFX_AddByName(id, "ReaComp", false, 1)
--------------- (Track Id, Name of FX, Position, True)

reaper.TrackFX_Show(id, 0, 3)

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


reaper.Undo_EndBlock("Add FX to Selected track", -1)
-------------- (Creating restore point)




My new question is, how do I toggle on/off to hide back the floating window on the same keycommand?

I think the best way I could learn would be to know what is the original code in the Action "Track: Insert/show reaEQ (track EQ)"
and be able to mess with it in a ReaScript. Is this possible some how?


Thanks again in advance
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 04-01-2018 at 05:23 AM. Reason: solved
D Rocks is offline   Reply With Quote
Old 03-31-2018, 12:16 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by D Rocks View Post
Is it possible to EDIT an Action built-in Reaper by getting its code
As Reaper is not an open source product you can't edit the code of it's internal working.

OTOH usually this is not necessary (or even desirable) as Reaper provides a ton of API hooks that you can access to (e.g.) "remote-control" it's features. Scripts is multiple languages (eel, LUA, Python), dedicated Reaper extensions, VST plugins, Themes ("GUI extensions") ... Using those you can create your own functionality and hook it to automatic or user actions.

-Michael
mschnell is online now   Reply With Quote
Old 03-31-2018, 04:27 AM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Not an answer to the actual question, but just to know, since 5.77 it's possible to assign shortcuts for FX directly.

Quote:
FX: add support for assigning shortcuts to insert specific FX or FX chains
FX: optionally show assigned shortcuts in the Add FX dialog (Options/Show in FX list)
nofish is offline   Reply With Quote
Old 03-31-2018, 05:36 AM   #4
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Thank you very much to both of you guys this is helpful to me.

I understand that its not open source and I will study further the new features of 5.77.

Do you know what LUA or ELL code would be written to do a replicate of the BUILT IN action that Cockos created with the Track: ReaEQ Show/Insert?

I would just replace the code line where the plugin name is written to what I need

Until then Ill keep studying thanks for everything guys. I appreciate it!

Alex
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 03-31-2018, 06:06 AM   #5
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by D Rocks View Post
I would just replace the code line where the plugin name is written to what I need
Well, since Reaper is not open source, there's just no feasible way for you to do that.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 03-31-2018, 06:27 AM   #6
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Quote:
Originally Posted by Xenakios View Post
Well, since Reaper is not open source, there's just no feasible way for you to do that.
Hey Thanks for your reply!
Yes I understand this.


In other words I'm trying to know if one can can help me to know how to CODE a replicate of this (subjectively) perfect action "Track: Insert/show reaEQ (track EQ)".
Then I'd use this LUA/ELL code to Insert/show the "plugin name" I need.



I think this now needs to me moved to "ReaScript forums"

Thanks guys
Much appreciated for your replies
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 03-31-2018, 06:30 AM   #7
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by D Rocks View Post
Thank you very much to both of you guys this is helpful to me.

I understand that its not open source and I will study further the new features of 5.77.

Do you know what LUA or ELL code would be written to do a replicate of the BUILT IN action that Cockos created with the Track: ReaEQ Show/Insert?

I would just replace the code line where the plugin name is written to what I need

Until then Ill keep studying thanks for everything guys. I appreciate it!

Alex
Insert ReaEQ and ReaComp to selected tracks (or toggle show/hide if FXs already exist):
Code:
local fx_table = {"ReaEQ", "ReaComp"}

function insert_FXs()
  local sel_track_count = reaper.CountSelectedTracks(0)
  reaper.Undo_BeginBlock()
  for i=1, sel_track_count do
    local track = reaper.GetSelectedTrack(0, i-1)
    for fx=1, #fx_table do
      local fx_index = reaper.TrackFX_AddByName(track, fx_table[fx], false, 1)
      reaper.TrackFX_SetOpen(track, fx_index, not reaper.TrackFX_GetOpen(track, fx_index))
    end
  end
  reaper.Undo_EndBlock("Insert FX(s) to selected tracks", -1);
end

insert_FXs()
spk77 is offline   Reply With Quote
Old 03-31-2018, 06:30 AM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by D Rocks View Post
I think this now needs to me moved to "ReaScript forums"
Yep.

Supposedly using a script you can remote-control Reaper to do what you have in mind.

-Michael
mschnell is online now   Reply With Quote
Old 03-31-2018, 06:37 AM   #9
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Quote:
Originally Posted by spk77 View Post
Insert ReaEQ and ReaComp to selected tracks (or toggle show/hide if FXs already exist):
Code:
local fx_table = {"ReaEQ", "ReaComp"}

function insert_FXs()
  local sel_track_count = reaper.CountSelectedTracks(0)
  reaper.Undo_BeginBlock()
  for i=1, sel_track_count do
    local track = reaper.GetSelectedTrack(0, i-1)
    for fx=1, #fx_table do
      local fx_index = reaper.TrackFX_AddByName(track, fx_table[fx], false, 1)
      reaper.TrackFX_SetOpen(track, fx_index, not reaper.TrackFX_GetOpen(track, fx_index))
    end
  end
  reaper.Undo_EndBlock("Insert FX(s) to selected tracks", -1);
end

insert_FXs()
Holy, thanks man I'll try messing with this baseline!! Thanks so much !!
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 03-31-2018, 06:49 AM   #10
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

I hope it will work
spk77 is offline   Reply With Quote
Old 03-31-2018, 07:04 AM   #11
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Quote:
Originally Posted by spk77 View Post
I hope it will work
I'm very happy to tell you that it does work!

https://stash.reaper.fm/33194/script.gif

The only exception to this is on the Master Track, I don't know why Reaper seems to treat the Master Track in another unique way?
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 03-31-2018, 07:12 AM   #12
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by D Rocks View Post
I'm very happy to tell you that it does work!

https://stash.reaper.fm/33194/script.gif

The only exception to this is on the Master Track, I don't know why Reaper seems to treat the Master Track in another unique way?
Try this (I replaced two functions):
Code:
local fx_table = {"ReaEQ", "ReaComp"}

function insert_FXs()
  local sel_track_count = reaper.CountSelectedTracks2(0, true)
  reaper.Undo_BeginBlock()
  for i=1, sel_track_count do
    local track = reaper.GetSelectedTrack2(0, i-1, true)
    for fx=1, #fx_table do
      local fx_index = reaper.TrackFX_AddByName(track, fx_table[fx], false, 1)
      reaper.TrackFX_SetOpen(track, fx_index, not reaper.TrackFX_GetOpen(track, fx_index))
    end
  end
  reaper.Undo_EndBlock("Insert FX(s) to selected tracks", -1);
end

insert_FXs()
spk77 is offline   Reply With Quote
Old 03-31-2018, 07:32 AM   #13
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

https://stash.reaper.fm/33195/script2.gif

Wow it works man!
Thanks alot I really appreciate it for real.. I spent the whole friday night trying to do it myself wasn't able to understand alone. Thanks!

I still have 2 questions if you are still willing and have free time:
1. how to be sure that this is the most efficient coding lines to replicate and that there are no useless coding?
2. how do we implement GetTrackUnderMouseCursor to work with this in any context either Arrange view or Mixer?

Thanks again and in advance for your reply
PS: I will use this function as my Number 1 action, will be repeated very often in every project thats why I ask for further info

Alex


EDIT: What does "For i=1 sel_track_count do" means?
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 03-31-2018 at 09:05 AM.
D Rocks is offline   Reply With Quote
Old 03-31-2018, 09:26 AM   #14
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

https://stash.reaper.fm/33196/script3.gif

Look at this my friend. Its crazy fast I've never seen that before! Its almost like thinking and doing without touching.
I've taken your script to open Pro-Q and because I don't know how to code directly in LUA "select track Under mouse" and Center the FX Window at mouse cursor... I've used custom actions to complete the cycle.


Following this, do you know how to code this directly in LUA (for learning purposes):

1. Select Track Under Mouse Cursor
2. Add FX Name if not inserted /or show if already inserted (including master trck)
3. Center Active Floating Window at Mouse Cursor (horizontal: middle Vertical: middle)


Thanks again,
Alex
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 03-31-2018, 11:02 AM   #15
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by D Rocks View Post
Its crazy fast I've never seen that before!
That normal with Reaper
-Michael
mschnell is online now   Reply With Quote
Old 03-31-2018, 11:39 AM   #16
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by D Rocks View Post
https://stash.reaper.fm/33195/script2.gif

Wow it works man!
Thanks alot I really appreciate it for real.. I spent the whole friday night trying to do it myself wasn't able to understand alone. Thanks!

I still have 2 questions if you are still willing and have free time:
1. how to be sure that this is the most efficient coding lines to replicate and that there are no useless coding?
2. how do we implement GetTrackUnderMouseCursor to work with this in any context either Arrange view or Mixer?

Thanks again and in advance for your reply
PS: I will use this function as my Number 1 action, will be repeated very often in every project thats why I ask for further info

Alex


EDIT: What does "For i=1 sel_track_count do" means?
1. I'm not a professional coder, so it's quite difficult to answer ...I have learnt a lot by modifying other people's code.
2. See the script I posted (it replicates the custom action that you posted).
There's also "reaper.BR_GetMouseCursorContext()" (see the Reascript documentation)


Code:
local fx_table = {"ReaEQ"}

function insert_FXs()
  reaper.Undo_BeginBlock()
  -- Run action from the action list:
  reaper.Main_OnCommand(41110, 0) -- Select track under mouse (right click on the action list to get the command ID)
  -- "Select track under mouse" sets exactly one track selected -> get the track pointer
  local track = reaper.GetSelectedTrack2(0, 0, true) 
  for fx=1, #fx_table do -- loop from "1" to length of "fx_table"
    local fx_index = reaper.TrackFX_AddByName(track, fx_table[fx], false, 1)
    reaper.TrackFX_SetOpen(track, fx_index, not reaper.TrackFX_GetOpen(track, fx_index))
  end
  -- Get the command ID number for named command that was registered by an extension such as
  -- "_SWS_ABOUT" or "_113088d11ae641c193a2b7ede3041ad5" for a ReaScript or a custom action.
  local action_number = reaper.NamedCommandLookup("_BR_MOVE_FX_WINDOW_TO_MOUSE_H_M_V_M")
  -- Pass the "action_number" to "Main_OnCommand" to run the action
  reaper.Main_OnCommand(action_number, 0)
  reaper.Undo_EndBlock("Insert FX(s) to track under mouse cursor", -1);
end

insert_FXs()

Last edited by spk77; 03-31-2018 at 11:53 AM.
spk77 is offline   Reply With Quote
Old 03-31-2018, 05:45 PM   #17
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Man I am extremely thankful for this. Its the best way to learn and you really help me.

Ill experiment with it

Alex
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 03-31-2018, 09:08 PM   #18
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

https://stash.reaper.fm/33204/script4.gif

Here is what I decided to do after testing the latest code you gave me

I actually found that using the built-in Custom Action + Script from you is the best!!

keycommand 1 on my keyboard = insert/show Pro-Q 2 at mouse cursor
keycommand 2 on my keyboard = insert/show Pro-MB at mouse cursor

Dude I am so HAPPY I'll donate you a few dollars for a beer!!!

This script and custom action needs to be shared to the Reaper community. So useful!

Thanks
Alex
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 04-01-2018, 12:18 AM   #19
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by D Rocks View Post
This script and custom action needs to be shared to the Reaper community. So useful!
That is why we have ReaPack.
Here such scripts can be shared, including decent "about:" information to enable anybody to easily find it and describing how exactly to use it. ReaPack will automatically install requested scripts.

-Michael
mschnell is online now   Reply With Quote
Old 04-01-2018, 05:16 AM   #20
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by D Rocks View Post
https://stash.reaper.fm/33204/script4.gif

Here is what I decided to do after testing the latest code you gave me

I actually found that using the built-in Custom Action + Script from you is the best!!

keycommand 1 on my keyboard = insert/show Pro-Q 2 at mouse cursor
keycommand 2 on my keyboard = insert/show Pro-MB at mouse cursor

Dude I am so HAPPY I'll donate you a few dollars for a beer!!!

This script and custom action needs to be shared to the Reaper community. So useful!

Thanks
Alex
Thanks for the donation! Yes, it's very useful script/action
spk77 is offline   Reply With Quote
Old 04-01-2018, 05:20 AM   #21
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Quote:
Originally Posted by mschnell View Post
That is why we have ReaPack.
Here such scripts can be shared, including decent "about:" information to enable anybody to easily find it and describing how exactly to use it. ReaPack will automatically install requested scripts.

-Michael
Yeah good idea thanks. I need to get more into ReaPack I'm not yet used to it
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 04-01-2018, 05:21 AM   #22
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Quote:
Originally Posted by spk77 View Post
Thanks for the donation! Yes, it's very useful script/action
You're welcome it saved me so much headache as I'm not a coder yet and needed this quickly

Alex
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 02-12-2019, 12:18 PM   #23
TobyAM
Human being with feelings
 
Join Date: Feb 2017
Location: Hollywood, CA
Posts: 125
Default

I love when you go on Reaper forums looking for a way to quickly bring up Pro-Q on a floating window, and it's ready to implement!
TobyAM 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 02:54 AM.


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