Old 05-24-2019, 09:23 AM   #481
DaveKeehl
Human being with feelings
 
DaveKeehl's Avatar
 
Join Date: Nov 2015
Location: Switzerland
Posts: 1,761
Default

Hi, I just started coding some scripts in lua for reaper and I don't understand what HWND means (for example in reaper.GetMainHwnd). Can someone explain it to me?
DaveKeehl is offline   Reply With Quote
Old 05-24-2019, 09:26 AM   #482
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,183
Default

Quote:
Originally Posted by DaveKeehl View Post
Hi, I just started coding some scripts in lua for reaper and I don't understand what HWND means (for example in reaper.GetMainHwnd). Can someone explain it to me?
It's an object, that reflects a window or a gui-element in a window.

For instance GetMainHwnd returns the object of Reaper's main window(the one with the arrangeview in it) and you can manipulate it using appropriate functions.
If you use the most recent version of SWS and/or the js-extension, there are functions, who allow you to do that, like getting/changing position, title, scrollstate of the window, etc.

When I say, gui-element: not all Gui-elements in Reaper have a hwnd, only the ones that are system-dialogs/elements. For instance, all elements in the Render to File-dialog have hwnds, the solo button of a track has not(afaik)


Edit: try experimenting with JS_Window_SetTitle to get an idea.
https://mespotin.uber.space/Ultrasch...indow_SetTitle

Needs the js-extension-plugin, which you can get here: https://forum.cockos.com/showthread.php?t=212174
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 05-29-2019, 06:50 AM   #483
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,782
Default

Adding to mespotine,
https://docs.microsoft.com/en-us/cpp...d?view=vs-2019

So, a handle (specific type of pointer)* to a window.

*Though handle and pointer are not fully equivalent:
https://stackoverflow.com/questions/...things/1923646
nofish is offline   Reply With Quote
Old 05-31-2019, 07:30 AM   #484
sw_
Human being with feelings
 
Join Date: Oct 2018
Posts: 22
Default

How do I convert the volume and pan from GetTrackUIVolPan to a 0-127 CC value? In other words I'd like to convert the pan (-1 to 1) range to 0-127 and the tracks max and min volume to 0-127.

I get the internal values in the console, it's just that I have to reformat them before passing the values along with StuffMIDIMessage since that wound pass negative values. Please help ! I need this for my diy motorized fader to work.
sw_ is offline   Reply With Quote
Old 05-31-2019, 02:26 PM   #485
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,668
Default

Code:
round((floatValue + 1.0) * (127.0 / 2.0))

Last edited by cfillion; 05-31-2019 at 02:37 PM.
cfillion is offline   Reply With Quote
Old 06-01-2019, 08:32 AM   #486
sw_
Human being with feelings
 
Join Date: Oct 2018
Posts: 22
Default

Quote:
Originally Posted by cfillion View Post
Code:
round((floatValue + 1.0) * (127.0 / 2.0))
Amazing!! Thanks!! Do you by any chance know this?

How do I send a 14 bit midi message over midi? I only seem to be able to send up to 255 with stufffmidimessage.
sw_ is offline   Reply With Quote
Old 06-01-2019, 10:46 AM   #487
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Location: Croatia
Posts: 2,076
Default

TrackFX_GetInstrument() returns -1 if instrument is offline? Any simple way around this?
__________________
My contributions
Breeder 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:39 PM.


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