|
|
|
06-20-2022, 03:11 PM
|
#1801
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
Hi Julian one question, when reaper is maximized:
Code:
retval, window_left, window_top, window_right, window_bottom = reaper.JS_Window_GetRect( reaper_hwnd )
why it reports some negative coordinates?
If I offset the window a bit to the right LEFT reports 0 but its like 5-10 pixels off the screen
Windows 10, QHD Monitor 2560x1440
|
|
|
06-21-2022, 01:08 AM
|
#1803
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
Oh ok, is something similar happening on OsX and Linux?
|
|
|
06-23-2022, 08:25 AM
|
#1804
|
Banned
Join Date: Dec 2018
Posts: 642
|
Waveform display on a take with active volume envelope?
If you have a REAPER take with an active/armed volume envelope, is there some way to make REAPER display the waveform (peaks) as if the envelope was NOT active?
Also, if that is possible, is there a way to shade the waveform with a tint or overlay to give some visual reference that there is an active volume envelope on the take?
|
|
|
06-23-2022, 12:52 PM
|
#1805
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by cohler
If you have a REAPER take with an active/armed volume envelope, is there some way to make REAPER display the waveform (peaks) as if the envelope was NOT active?
|
If you are referring to pre-FX Volume, there is a setting "Scale peaks by pre-fx volume/pan envelopes" that can be disabled.
Quote:
Originally Posted by cohler
Also, if that is possible, is there a way to shade the waveform with a tint or overlay to give some visual reference that there is an active volume envelope on the take?
|
You can use the ReaScriptAPI extension to display overlays, but it might be easier to simply set the take color.
|
|
|
06-23-2022, 01:13 PM
|
#1806
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by juliansader
If you are referring to pre-FX Volume, there is a setting "Scale peaks by pre-fx volume/pan envelopes" that can be disabled.
You can use the ReaScriptAPI extension to display overlays, but it might be easier to simply set the take color.
|
No, I am referring to item take envelopes, not track envelopes. That setting has no effect on peak scaling caused by take envelopes.
For the shading, I want it to only be over one section of an item/take, so take color is useless for that.
|
|
|
06-24-2022, 05:01 PM
|
#1807
|
Banned
Join Date: Dec 2018
Posts: 642
|
So how does one display overlays using JS_ReaScriptAPI?
And I presume then the answer is that there is no way to display takes with peaks (aka waveform display) unaffected by active take envelopes? If that is the case, this should definitely be added as a selectable feature.
|
|
|
06-29-2022, 12:49 PM
|
#1808
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by cohler
So how does one display overlays using JS_ReaScriptAPI?
|
You can use the JS_Composite functions to overlay a LICE bitmap over a section of a target window. To see how it's done, I would suggest checking out amagalma's fantastic script "Toggle show editing guide line on item under mouse cursor". You can also browse this thread for more discussions about using the compositing functions.
If anything's unclear, please let us know!
Quote:
Originally Posted by cohler
And I presume then the answer is that there is no way to display takes with peaks (aka waveform display) unaffected by active take envelopes? If that is the case, this should definitely be added as a selectable feature.
|
Good that you spotted this. I would regard it as a bug, and it should be reported. That setting should affect the take volume envelope too.
|
|
|
06-29-2022, 05:13 PM
|
#1809
|
Banned
Join Date: Dec 2018
Posts: 642
|
Quote:
Originally Posted by juliansader
You can use the JS_Composite functions to overlay a LICE bitmap over a section of a target window. To see how it's done, I would suggest checking out amagalma's fantastic script "Toggle show editing guide line on item under mouse cursor". You can also browse this thread for more discussions about using the compositing functions.
If anything's unclear, please let us know!
Good that you spotted this. I would regard it as a bug, and it should be reported. That setting should affect the take volume envelope too.
|
Thank you for the pointers on JS_Composite, LICE bitmaps and amagalma's scripts!
I will go ahead and report the take volume envelope bug as well.
|
|
|
07-19-2022, 06:53 AM
|
#1810
|
Human being with feelings
Join Date: Jul 2022
Posts: 7
|
Get imported media directory path
Hi everyone.
First of all thanks to this big community for sharing the knowledge and allow people to teach themselves. And a big thanks to @juliansader for the awesome work on JS api.
After many months of practicing lua and learning from this wonderful forum I finaly get to post for the first time.
My question:
Basically i'm working on a tool that i want to use to create quick variations of many layers. My script basically duplicate items and pick randomly in the folder where is the original take and pick a different wav file.
Right now when I start my script i use a function that pops a window where I specify manually the exact folder path where I want the script to pick randomly a variation of my take.
I'm trying to make this step automatic and for that I need to figure a way to get or to store the original source path on an imported audio file. So when I run my script it knows the origin directory path of the selected take. Of course I still want my media to be copied in my local reaper session when imported. I'm facing a blocker where i couldn't find a way to do that. I tried different things :
- I tried to use JS function in de media explorer to store in a text file the path of selected media in the list view. It works but only when you are selecting media that are not in a database. Because when you are in a database the combobox return only the database name. It does not work as well when you drag and drop file directly on a reaper track.
- I tried a python script , a watchdog script ( kind of FileSystemWatcher) that is localised in my media folder in my local reaper session. My goal was to store in a text file all the origin directory path of audio files imported in my reaper project. I was able to make it works, but only if my script is hierarchically parent of my reaper session folder and of my mediabay folder. It does not work when files are imported from a different or external drive.
If anyone have a suggestion on the right way to do what i'm trying to achieve it will be realy helpful.
Thanks in advance for any suggestions.
Peace !
|
|
|
07-21-2022, 10:37 AM
|
#1811
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Perhaps you can use GetMediaItemTake_Source to get the source of the take, and then GetMediaSourceFileName to get the path?
|
|
|
07-24-2022, 09:50 AM
|
#1812
|
Human being with feelings
Join Date: Jul 2022
Posts: 7
|
Hi Julian
Thanks for your answer. I did try that but unfortunately the moment you importe a file in reaper it copies the file automatically in the local reaper session folder. So when I run this commands it returns the path of the source in my local reaper session and not the origin path
Thank you for your help
|
|
|
07-24-2022, 11:02 AM
|
#1813
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Quote:
Originally Posted by Raskal
Because when you are in a database the combobox return only the database name.
|
One possible workaround for that might be to temporarily switch the view to show full/leading paths, do your stuff, then restore the settings.
Have a look at the function MediaExplorer_GetSelectedAudioFiles(), show_full_path, show_leading_path,..
https://forum.cockos.com/showpost.ph...2&postcount=12
|
|
|
07-24-2022, 11:10 AM
|
#1814
|
Human being with feelings
Join Date: Jul 2022
Posts: 7
|
Thanks Edgemeal
I finally ended up doing exactly that
It works but I was wondering if you know how I could prevent the ui to refresh for the moment I do my work switching the full/leading path in the media explorer ?
I tried preventuirefresh function but it didn’t work :/
Many thanks in advance
|
|
|
07-24-2022, 11:56 AM
|
#1815
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Hmmm, the ListView doesn't flicker at all here (Win10). In Windows (vb.net) I send the WM_SETREDRAW msg to RichTextBox and it works great, but never tried it on ListView (.net has built-in solution).
https://docs.microsoft.com/en-us/win...i/wm-setredraw
EDIT, My guess is REAPER devs enabled double buffering for the ListView (on Win OS) because resizing columns also doesn't flicker and by defualt the LV control will flicker really bad when doing that if not set.
Last edited by Edgemeal; 07-24-2022 at 12:02 PM.
Reason: TYPO
|
|
|
07-24-2022, 12:02 PM
|
#1816
|
Human being with feelings
Join Date: Jul 2022
Posts: 7
|
Thanks for your answer Edgemeal.
I’m gonna look at that. Gonna give it a try.
Thank you
|
|
|
07-24-2022, 12:11 PM
|
#1817
|
Human being with feelings
Join Date: Jul 2022
Posts: 7
|
Just a last quick question.
Is there a way to call a c++ script from reascript Lua ?
Many thanks in advance
|
|
|
07-24-2022, 12:15 PM
|
#1818
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Quote:
Originally Posted by Raskal
Thanks for your answer Edgemeal.
I’m gonna look at that. Gonna give it a try.
Thank you
|
Good luck, and let us know if it works.
FWIW my .net code just to get an idea of how I used it on RichEditBox..
note: WM_SETREDRAW = 0xB
Code:
Public Sub LockRedraw(ctl As Control) ' lock drawing
SendMessage(ctl.Handle, WM_SETREDRAW, 0, 0)
End Sub
Public Sub UnLockRedraw(ctl As Control) ' unlock drawing and invalidate control
SendMessage(ctl.Handle, WM_SETREDRAW, 1, 0)
ctl.Invalidate()
End Sub
|
|
|
07-24-2022, 12:19 PM
|
#1819
|
Human being with feelings
Join Date: Jul 2022
Posts: 7
|
Thank you so much. I will let you know if I succeed
|
|
|
07-27-2022, 12:33 PM
|
#1820
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by Raskal
Just a last quick question.
Is there a way to call a c++ script from reascript Lua ?
Many thanks in advance
|
You mean, C++-sourcecode to run it?
If yes, then, no, as they are completely different beasts and not compatible this way.
|
|
|
08-07-2022, 12:36 AM
|
#1821
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,902
|
Hi !
Is there a way to get all element of a listview rather than looping through each items ? with table withs tons of entry, the get list item function can become quite slow.
Thx !
EDIT: maybe JS_ListView_GetItemText is a bit faster ?
Well, not instant (4s) in my case (100 000) but should be acceptable.
Last edited by X-Raym; 08-07-2022 at 02:17 AM.
|
|
|
08-08-2022, 02:17 AM
|
#1823
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,902
|
As explained by amagalma here, we miss a Header_GetItemText function. :S
This would be a nice addition for window parsing
|
|
|
08-08-2022, 01:32 PM
|
#1824
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Unfortunately, AFAIK, Header_GetItem has not yet been implemented in WDL/swell.
|
|
|
08-08-2022, 03:24 PM
|
#1825
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,902
|
@juliansader
Thx for expertise,
Not sure where I would need to ask for this ? Dont seems the github isssue tracks is very active.
|
|
|
08-18-2022, 06:18 AM
|
#1826
|
Human being with feelings
Join Date: Jun 2021
Location: Moscow, Russia
Posts: 282
|
Is there any chance that JS_VKeys_GetDown is slightly faster than JS_VKeys_GetState? I tried to catch Ctrl+Z shortcut in defer loop and 'State' sometimes misses my very quick presses of Ctrl+Z and 'Down' function seems to catch it every time.
Edit. Could someone explain me please, why fast pressed shortcut sometimes couldn’t be caught in defer loop while temperate press just works ok? Workaround?
Last edited by McSound; 08-18-2022 at 04:46 PM.
|
|
|
08-29-2022, 12:25 PM
|
#1827
|
Human being with feelings
Join Date: Dec 2015
Location: Folkestone
Posts: 196
|
SDK methods available
Just getting going again coding in Reaper after quite a few years off, so please forgive my dumb questions while I speed up.
Does js_ReascriptAPI_extension expose a subset of stuff available in the extension SDK?
In particular I am interested in the Cockos VST extensions
https://www.reaper.fm/sdk/vst/vst_ext.php
The method is given by example for setting a named parameter (named_parameter_name) of a VST :
effVendorSpecific(effSetChunk,(VstIntPtr) named_parameter_name, buffer, 0.0)
Sets the string value for named_parameter_name, return 0xf00d if supported.
Trying to hack around with Relearn 2 which Benjamin reports can be controlled from outside via this approach, and receives a serialised state of the container to configure it.
If it's either much easier or the only way to go, I'm happy working with extensions/SDK approach, but would find scripting more fun
|
|
|
08-30-2022, 01:47 PM
|
#1828
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by McSound
Is there any chance that JS_VKeys_GetDown is slightly faster than JS_VKeys_GetState? I tried to catch Ctrl+Z shortcut in defer loop and 'State' sometimes misses my very quick presses of Ctrl+Z and 'Down' function seems to catch it every time.
Edit. Could someone explain me please, why fast pressed shortcut sometimes couldn’t be caught in defer loop while temperate press just works ok? Workaround?
|
Sorry for not replying sooner -- I didn't notice the edits.
GetDown and GetState use exactly the same underlying data, so they are equally fast.
Defer loops are executed about 30 times per second (and often slower), so if you press and release a shortcut key very quickly, you can do it in less time than one defer cycle.
GetState will miss keys that are clicked so quickly, because by the time the script queries the state, the state has reverted back to the original 0.
|
|
|
08-31-2022, 02:57 AM
|
#1829
|
Human being with feelings
Join Date: Jun 2021
Location: Moscow, Russia
Posts: 282
|
Very helpful! Thanks juliansader!
|
|
|
09-07-2022, 03:49 PM
|
#1830
|
Human being with feelings
Join Date: Sep 2020
Posts: 149
|
reaper.JS_LICE_RotatedBlit(identifier destBitmap,integer dstx,integer dsty,integer dstw,integer dsth,identifier sourceBitmap,number srcx,number srcy,number srcw,number srch,number angle,number rotxcent,number rotycent,boolean cliptosourcerect,number alpha,string mode)
What does all dis crazy numbers mean?
|
|
|
09-08-2022, 03:28 AM
|
#1831
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Here is some documentation from the video processor function gfx_rotoblit, which may be similar:
integer srcidx
the source-image, that shall be blit as rotated image
float angle
the angle by width the image shall be rotated
optional integer x
the x-position in pixels, at which the blitting shall be put to
optional integer y
the y-position in pixels, at which the blitting shall be put to
optional integer w
the width in pixels of the rotated-blit-image; affects stretching of the image!
optional integer h
the height in pixels of the rotated-blit-image; affects stretching of the image!
optional integer srcx
the x-position in pixels in the source-image, from which to blit from
optional integer srcy
the y-position in pixels in the source-image, from which to blit from
optional integer w
the width in pixels of the source-image, from which to blit from; affects stretching of the image!
optional integer h
the height in pixels of the source-image, from which to blit from; affects stretching of the image!
optional integer cliptosrcrect=0
clips the source-image rectangle; 1, clip; 0, don't clip
optional integer centxoffs=0
adds an offset to the center of the image at x-position in pixels
optional integer centyoffs=0
adds an offset to the center of the image at x-position in pixels
|
|
|
09-08-2022, 03:30 AM
|
#1832
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by jamesd256
Does js_ReascriptAPI_extension expose a subset of stuff available in the extension SDK?
In particular I am interested in the Cockos VST extensions
|
It exposes the extension SDK, but unfortunately not the VST stuff.
|
|
|
09-12-2022, 02:02 AM
|
#1833
|
Human being with feelings
Join Date: Dec 2015
Location: Folkestone
Posts: 196
|
JS_LICE_DrawChar
Trying out JS_LICE_DrawChar, but it seems impossible with Lua:
Code:
reaper.JS_LICE_DrawChar(dest_bmp, 200,200, 40,0x000000, 1, '')
'reaper.JS_LICE_DrawChar' argument 4: unknown type char
The docs say argument 4 is an integer
|
|
|
09-13-2022, 03:42 AM
|
#1834
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Thanks for the bug report! I will fix this for the next update. Try using DrawText in the meantime.
|
|
|
09-25-2022, 07:55 AM
|
#1835
|
Human being with feelings
Join Date: Jan 2011
Posts: 69
|
JS_LICE_FillPolygon packedX and packedY?
JS_LICE_FillPolygon
For a script I'm writing, I'm trying to wrap my head around above mentioned function. The description says 'packedX and packedY are two strings of coordinates, each packed as "<i4"'.
Googling for "packed as <i4" leaves me with reviews for german cars.
What does that mean? Can anyone point me in the right direction?
|
|
|
09-25-2022, 02:08 PM
|
#1836
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
"<i4" refers to format strings for string.pack in Lua. Each coordinate is packed as a little-endian signed integer of 4 bytes.
|
|
|
09-25-2022, 08:30 PM
|
#1837
|
Human being with feelings
Join Date: Jan 2011
Posts: 69
|
Quote:
Originally Posted by juliansader
|
Thanks, I've found this in the meantime as well.
According to those docs, one would assume that the following should work but it doesn't. In this case it seems that only the first value is packed into the string.
Code:
-- does not work
packedX = string.pack("<i4", x1, x2, x3, ...)
packedY = string.pack("<i4", y1, y2, y3, ...)
But after some fiddling I found this to be working:
Code:
packedX = string.pack("<i4", x1) .. string.pack("<i4", x2) .. string.pack("<i4", x3) .. [...])
packedY = string.pack("<i4", y1) .. string.pack("<i4", y2) .. string.pack("<i4", y3) .. [...])
Is there a more elegant way?
|
|
|
09-26-2022, 02:11 AM
|
#1838
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
You can concatenate the format codes into a single string, with one code for each argument:
Code:
string.pack("<i4i4i4", x1, x2, x3)
(The endian option only needs to be given once at the beginning.)
|
|
|
09-26-2022, 07:08 AM
|
#1839
|
Human being with feelings
Join Date: Jan 2011
Posts: 69
|
Quote:
Originally Posted by juliansader
You can concatenate the format codes into a single string, with one code for each argument:
Code:
string.pack("<i4i4i4", x1, x2, x3)
(The endian option only needs to be given once at the beginning.)
|
Nice, much better. Thanks!
|
|
|
10-09-2022, 08:29 PM
|
#1840
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 662
|
reaper.JS_VKeys_GetState
Can I mask the detection key when entering the track name?
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:43 PM.
|