Old 04-02-2018, 12:52 PM   #361
fundorin
Banned
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
Default

How do I execute some code at the project load/switch?

I was using fixed arrays of 1024 elements to store tracks data (mute/pan/vol/etc) and decided to switch to vector of objects, with a single object for each track, containing the necessary data.
I've also added a resize vector method into the Run() function and in every function, that is called by Reaper (there are bunch of them already in the example).
It was going fine until I've tried to load an existing project. Reaper then crashed with vector subscript out of range error.
I guess, resize should also be executed at the project loading or switching to another project's tab, but I don't know ho do I track it. Any help would be appreciated.

UPD. For some unknown reason, Reaper was calling track related function even when there weren't any tracks in the project, so it was giving the track number -1, which lead to crash, when the plugin tried to write track's vol/pan/etc state into the vector at index '-1'.
I don't know why does reaper_plugin.h calls those functions for track -1, so I've simply added a check, if the tracks number is zero or positive.

Last edited by fundorin; 04-02-2018 at 01:41 PM.
fundorin is offline   Reply With Quote
Old 05-04-2018, 05:17 PM   #362
sai'ke
Human being with feelings
 
sai'ke's Avatar
 
Join Date: Aug 2009
Location: Germoney
Posts: 155
Default

When I call the following:

Code:
  -- Fetch all the tracks
  for i=0,tracks-1 do
    local track   = reaper.GetTrack(project, i)  

    local ret, name = reaper.GetTrackName(track, "                                                              ")
    if ( name ~= "MASTER" ) then  
      local sendidx = reaper.CreateTrackSend(track, spectroTrack)
      local sn = reaper.SetTrackSendInfo_Value(track, 0, sendidx, "I_DSTCHAN", 2*i)
    end
  end

it seems that SetTrackSendInfo_Value doesn't actually create "new" audio channels. It only works for the ones that already exist 1/2, 3/4, 5/6. What's also interesting is that if I go to that track, and I try to add them manually, it still doesn't give me the options 7/8 and higher until I've fiddled around with all the inputs made by the script.

Is it possible to create new audio dest channels from lua (preferably without SWS)?
sai'ke is offline   Reply With Quote
Old 05-05-2018, 12:21 AM   #363
azslow3
Human being with feelings
 
Join Date: Nov 2017
Location: Heidelberg, Germany
Posts: 490
Default

I think adding the following before loop
Code:
reaper.SetMediaTrackInfo_Value(spectroTrack, "I_NCHAN", tracks*2)
should do the trick
azslow3 is offline   Reply With Quote
Old 05-05-2018, 04:02 AM   #364
sai'ke
Human being with feelings
 
sai'ke's Avatar
 
Join Date: Aug 2009
Location: Germoney
Posts: 155
Default

Quote:
Originally Posted by azslow3 View Post
I think adding the following before loop
Code:
reaper.SetMediaTrackInfo_Value(spectroTrack, "I_NCHAN", tracks*2)
should do the trick
Thanks man, it did!
sai'ke is offline   Reply With Quote
Old 05-17-2018, 08:39 PM   #365
ausbaxter
Human being with feelings
 
Join Date: Apr 2016
Posts: 37
Default

Is there a way to get a mouse left click or any click event outside of a gfx window? (preferably without having to instantiate a window at all) As far as I've seen in the API there isn't a way to do this. I'm looking to run code between mouse down and up events within the reaper arrange window.

I'm looking more into python which seems to have some libraries to help, but I'm really hoping to keep this script in lua or eel.
ausbaxter is offline   Reply With Quote
Old 07-07-2018, 03:14 PM   #366
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,114
Default

How do I get the "pin" icon in the top right hand corner to keep my window (generated from reaper extension" on top?

thanks

oli
__________________
VirtualCZ | pMix | Endless Series | WDL-OL | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
olilarkin is offline   Reply With Quote
Old 07-07-2018, 07:59 PM   #367
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,300
Default

SWS does it with the undocumented API function AttachWindowTopmostButton when handling WM_INITDIALOG. It's not included in reaper_plugin_functions.h.

Code:
void (*AttachWindowTopmostButton)(HWND hwnd);
cfillion is offline   Reply With Quote
Old 07-08-2018, 05:27 AM   #368
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,114
Default

thanks!
__________________
VirtualCZ | pMix | Endless Series | WDL-OL | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
olilarkin is offline   Reply With Quote
Old 08-25-2018, 11:52 AM   #369
mrelwood
Human being with feelings
 
mrelwood's Avatar
 
Join Date: Nov 2006
Location: Finland
Posts: 1,255
Default

In short, I can't get a graphical slider to run commands in the @slider section in a JS plugin. I expected the slider_automate(sliderX) to do just that. Was I wrong?

In detail:

I have a graphical slider that I wish to use to adjust a basic JS slider1. The slider1 itself adjusts fine, but I can't get it to run the commands in the @slider section.

Say the graphical slider adjusts a parameter called "gfxslider". Even if:

Code:
@slider
parameter1 = slider1;

...

@gfx
slider1 != gfxslider ? (
  slider1 = gfxslider;
  slider_automate(slider1);
  );
The last part can be in @block or @sample, same result, slider1 changes but "parameter1" does not. Only way I've found is to have the "parameter1 = slider1" command in @block, @sample or @gfx instead of the @slider section.
__________________
______Announcing__mrelwood plugins______
.. MacBook Pro 15" Late '13 .. Focusrite: Scarlett 6i6, Saffire Pro 24 DSP (+ADA8000) .. Behringer FCA610 .. Focal: Alpha 65, CMS 40, Listen Pro ..
mrelwood is offline   Reply With Quote
Old 08-25-2018, 01:27 PM   #370
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 6,141
Default

Rather obviously @slider is only called when a slider is modified from outside the JSFX code.

You might try to do a function that contains what you want to do in @slider and do something like

Code:
@init 
  function do_slider() (
    parameter1 = slider1;
  );

@slider
  do_slider();

@gfx
  slider1 != gfxslider ? (
    slider1 = gfxslider;
    do_slider();
  );
__________________
www.boa-sorte.de
mschnell is online now   Reply With Quote
Old 08-25-2018, 02:12 PM   #371
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 432
Default

Hey guys,

Is it possible to use the SWS marque zoom tool with a mouse modifier and NOT the middle mouse button drag? I find that this middle click often messes up with my mouse moving the wheel by accident. This mouse also has left right move for the middle button so it also messes up the middle drag.
I'd like to use the SWS Zoom tool exactly as is works by default but with right button drag rather than middle click.

is it possible?

Yes, I've tried the action menu but this way it introduces an on/off state and you need mutiple clicks. I've also tried Autohotkey to disable my left/right middle button triggers but it doesnt help since the middle click is considered released
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 08-25-2018 at 02:22 PM.
D Rocks is offline   Reply With Quote
Old 08-25-2018, 02:44 PM   #372
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,232
Default

Marquee zoom is also available as Mouse modifier, Arrange view -> right drag.
Wouldn't that do as substitute ?

edit:
I don't think Reaper's native marquee zoom has the undo functionality SWS zoom tool has though, so probably not a full substitute.

Last edited by nofish; 08-25-2018 at 03:12 PM.
nofish is offline   Reply With Quote
Old 08-25-2018, 03:06 PM   #373
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 432
Default

yes it works but the only problem I didnt find how to manage is that this zoom is not considered as an undo step for the SWS undo zoom.
I don't want the SWS to undo MouseWheel zoom steps cause its a waste of time, but lets say I use the Reaper Marquee zoom, it will be ignored fro the undo history. This is the only thing that makes me absolutely want to use the SWS marquee instead.

thanks for reply
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 08-25-2018, 03:19 PM   #374
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,232
Default

Ah right, I edited my post before I saw yours, didn't think about the special undo zoom feature in SWS zoom tool at first.

I don't know if it's possible to use it in any other way than middle mouse button though (that's how I use it), sorry.
nofish is offline   Reply With Quote
Old 08-25-2018, 06:47 PM   #375
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 432
Default

No prob man theres alot of little details making this feature great. Thanks for taking time.

Any other insights?
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 09-06-2018, 12:57 AM   #376
Aries1985
Human being with feelings
 
Join Date: Jul 2011
Posts: 30
Default How to set value of plugin parameter displayed as TCP FX?

Hello guys,
is there an easy way how to set value for parameter displayed in TCP FX?

I have noticed functions CountTCPFXParms and GetTCPFXParm but nothing for setting value.

Any help is greatly appreciated!
Aries1985 is offline   Reply With Quote
Old 09-06-2018, 09:58 AM   #377
tparker24
Human being with feelings
 
Join Date: Dec 2017
Posts: 35
Default

Perhaps TrackFX_SetParam
tparker24 is offline   Reply With Quote
Old 09-06-2018, 11:48 AM   #378
Aries1985
Human being with feelings
 
Join Date: Jul 2011
Posts: 30
Default

Ah, I checked once more documentation for GetTCPFXParm - I did not realize it returns fx index and parameter index.

TrackFX_SetParam is the correct function, then.

Thanks.
Aries1985 is offline   Reply With Quote
Old 09-18-2018, 06:25 AM   #379
sai'ke
Human being with feelings
 
sai'ke's Avatar
 
Join Date: Aug 2009
Location: Germoney
Posts: 155
Default

I'm not sure if I'm using this command correctly but TrackFX_AddByName( track, fxname, recFX, instantiate ) doesn't seem to work for me for JSFX or VSTs with spaces in the name. I always figured it took the same name as in the search field, but I guess it doesn't?

What should I use here?
__________________
[Soundcloud] | [Tracker Plugin: Thread|Github|Reapack link] | [Machine UI Plugin: Thread|Github|Reapack link] | [Filther: Github]
sai'ke is offline   Reply With Quote
Old 10-02-2018, 04:42 PM   #380
sai'ke
Human being with feelings
 
sai'ke's Avatar
 
Join Date: Aug 2009
Location: Germoney
Posts: 155
Default

If anyone runs into the previous issue in the future. Seems that for JSFX it takes filenames... not sure why.

I have a new question though. How do I get the true length of an item (not the length on the arranger)? When stretching a MIDI or audio item, the item repeats and these notches appear. Is there a way to poll how long an item actually is (not D_LENGTH) in seconds from lua?
__________________
[Soundcloud] | [Tracker Plugin: Thread|Github|Reapack link] | [Machine UI Plugin: Thread|Github|Reapack link] | [Filther: Github]
sai'ke is offline   Reply With Quote
Old 10-02-2018, 05:06 PM   #381
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,232
Default

GetMediaSourceLength() ?

https://www.extremraym.com/cloud/rea...iaSourceLength

(maybe I'm misunderstanding though...)
nofish is offline   Reply With Quote
Old 11-14-2018, 03:53 PM   #382
Havokmann
Human being with feelings
 
Join Date: Mar 2010
Location: Brazil
Posts: 12
Default how do I: get item name in LUA

Hey there.
Total n00b here.
I need to get the item name in LUA.
It's for an action that will run on said item.
Can anyone help, please?
Havokmann is offline   Reply With Quote
Old 11-14-2018, 06:36 PM   #383
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,300
Default

Items don't have names themselves. You're probably looking for the take name which you can obtain using reaper.GetSetMediaItemTakeInfo_String. You can get the current take of an item using reaper.GetActiveTake.
cfillion is offline   Reply With Quote
Old 11-20-2018, 06:29 PM   #384
Rusty Falcon
Human being with feelings
 
Rusty Falcon's Avatar
 
Join Date: Sep 2012
Location: Alabama
Posts: 353
Default Script multiple item property changes on all selected items ?

OK so I have a set of actions I execute pretty regularly when prepping a mix. I normally do these by selecting a set of items to change, then using the Item Properties window:
- change item length to a value (0:0.045 normally, sometimes 0:0.040)
- change fade-in type to Type 5(the really steep up ramp)
- change fade-out type to Type 5 (the really steep down ramp)
- change fade-out length to a value, usually 0:0.020
- change fade-in length to 0:0.001

As you can guess, this gets annoyingly repetitive.

Do you think there is a way to create a custom action or script to execute all of these on the selected set of items ?

Total script newb so I have no idea where to start or even where to put a script to execute in Reaper!

TIA!
Brian
__________________
PRS 2014 Brushstroke 24 / PRS 2008 Custom 24 / Axe-FX 2
Reaper / RME HDSP Multiface 1 / Tannoy 502s / Monoprice 10" Subwoofer
Hughes and Kettner Tubemeister 18 and 1x12 cab
Rusty Falcon is offline   Reply With Quote
Old 11-21-2018, 09:24 AM   #385
Havokmann
Human being with feelings
 
Join Date: Mar 2010
Location: Brazil
Posts: 12
Default

Quote:
Originally Posted by cfillion View Post
Items don't have names themselves. You're probably looking for the take name which you can obtain using reaper.GetSetMediaItemTakeInfo_String. You can get the current take of an item using reaper.GetActiveTake.
Lol omg, that's why I was so lost. I kept looking for an item name.
Thanks, Cfillion!
Havokmann is offline   Reply With Quote
Old 11-21-2018, 09:48 AM   #386
Havokmann
Human being with feelings
 
Join Date: Mar 2010
Location: Brazil
Posts: 12
Default

Quote:
Originally Posted by Rusty Falcon View Post
OK so I have a set of actions I execute pretty regularly when prepping a mix. I normally do these by selecting a set of items to change, then using the Item Properties window:
- change item length to a value (0:0.045 normally, sometimes 0:0.040)
- change fade-in type to Type 5(the really steep up ramp)
- change fade-out type to Type 5 (the really steep down ramp)
- change fade-out length to a value, usually 0:0.020
- change fade-in length to 0:0.001

As you can guess, this gets annoyingly repetitive.

Do you think there is a way to create a custom action or script to execute all of these on the selected set of items ?

Total script newb so I have no idea where to start or even where to put a script to execute in Reaper!

TIA!
Brian
I believe you can do most of what you need by creating a Custom Action. If you want total automation, ie, no user input at all you can edit the original actions and hard code the values in it.

I suggested you have a look at "X-Raym_Set selected items fade-in fade-out length.lua"

Then after you hard code your values in it you can create a Custom Action that plays your edited version of the above script followed by "Item: Set fade-in shape to type 5"

Hope it helps.
Havokmann is offline   Reply With Quote
Old 11-21-2018, 02:44 PM   #387
Rusty Falcon
Human being with feelings
 
Rusty Falcon's Avatar
 
Join Date: Sep 2012
Location: Alabama
Posts: 353
Default

Quote:
Originally Posted by Havokmann View Post
I believe you can do most of what you need by creating a Custom Action. If you want total automation, ie, no user input at all you can edit the original actions and hard code the values in it.

I suggested you have a look at "X-Raym_Set selected items fade-in fade-out length.lua"

Then after you hard code your values in it you can create a Custom Action that plays your edited version of the above script followed by "Item: Set fade-in shape to type 5"

Hope it helps.
Thank you Havokmann. I found the X-Raym scripts location on GitHub and the fade-in fade-out script itself. Thanks for the pointer!

I ended up creating a Custom Action for myself consisting of in turn:
SWS: Set selected items length... (in seconds so I enter for example 0.045)
Item: Set fade-in shape to type 5
Item: Set fade-out shape to type 5
Script: X-Raym_Set selected items fade-in fade-out length.lua

Works a charm and saves me a ton of time using the Item Properties editor and bouncing between text entry and menu selections!

Thanks again!
Brian
__________________
PRS 2014 Brushstroke 24 / PRS 2008 Custom 24 / Axe-FX 2
Reaper / RME HDSP Multiface 1 / Tannoy 502s / Monoprice 10" Subwoofer
Hughes and Kettner Tubemeister 18 and 1x12 cab

Last edited by Rusty Falcon; 11-22-2018 at 09:22 PM. Reason: More info
Rusty Falcon is offline   Reply With Quote
Old 11-24-2018, 03:17 AM   #388
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 302
Default How do I make my Lua script dockable?

Yes HOW do I do it?

Have built script with Lokassenas GUI and found in a thread
that it didn't support docking - how can I fix this?

Regards
TompaD
__________________
ToDoList Donate Mark4Celest: Frid (i ditt hjärta) Eve & the Fisherman on Spotify
tompad is offline   Reply With Quote
Old 11-24-2018, 11:56 AM   #389
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 302
Default How do I get cmdID from Actionlist

Hi!

I know I can open Actionlist from a reascript, but how do I
get the selected actions cmdID back to my reascript(lua)??
__________________
ToDoList Donate Mark4Celest: Frid (i ditt hjärta) Eve & the Fisherman on Spotify
tompad is offline   Reply With Quote
Old 12-01-2018, 11:07 AM   #390
defibkid
Human being with feelings
 
Join Date: Aug 2016
Posts: 6
Default

Just saw this thread- repost from my own thread in the appropriate place...

I'm trying to build a script that will assign my control surface's knobs to tracks with "bus" in the name in order of track #. I've got my script to get the track numbers of each bus, tell how many are present, and sort them in an array, but I don't know how to actually do the assigning.

I figure this must be possible given that you can set track volume based on MIDI with Reaper's built-in actions, but I may be wrong. Any advice?
defibkid is offline   Reply With Quote
Old 12-05-2018, 06:59 AM   #391
sai'ke
Human being with feelings
 
sai'ke's Avatar
 
Join Date: Aug 2009
Location: Germoney
Posts: 155
Default

Is it possible to dump all variables of a JSFX (the ones you see in the right pane of the edit window)? There seems to be a very rare bug in one of my scripts, that doesn't happen on my end and I would like to prod the state that the JSFX gets in. Would be great if there was an ability to dump the JSFX state, so that I could get it for debugging purposes.
__________________
[Soundcloud] | [Tracker Plugin: Thread|Github|Reapack link] | [Machine UI Plugin: Thread|Github|Reapack link] | [Filther: Github]
sai'ke 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 10:35 AM.


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