Old 10-17-2019, 04:12 AM   #1
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 1,072
Default Lua Get JSFX Values

Is there any way I can read JSFX values from Lua ?

__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
MusoBob is offline   Reply With Quote
Old 10-17-2019, 06:11 AM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,347
Default

a) They're FX parameters, so you can use retval, minval, maxval = reaper.TrackFX_GetParam(track, fx, param), or

b) Use the gmem functions to have your JSFX store data in memory and then the Lua script can read it directly from there.
Lokasenna is offline   Reply With Quote
Old 10-17-2019, 01:37 PM   #3
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 1,072
Default

Thanks that works good ! if I put that in your GUI how would I get it to loop so it's always reading the JSFX parameter while the GUI is running ?
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
MusoBob is offline   Reply With Quote
Old 10-17-2019, 01:54 PM   #4
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,347
Default

You can start a defer loop yourself, or provide a function for the GUI to run on every update, and then have that function do the polling and update the GUI when there's a change.

Code:
local lastJsfxValue
local function watchJsfx()
  local jsfxValue = howeverYouGetTheValue()
  if jsfxValue ~= lastJsfxValue then
    updateStuffWith(jsfxValue)
    lastJsfxValue = jsfxValue
  end    
end

GUI.func = watchJsfx

-- GUI.func will run on every loop
-- Use this to set the poll time in seconds:
GUI.freq = 1.5
Lokasenna is offline   Reply With Quote
Old 10-21-2019, 03:56 PM   #5
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 1,072
Default

Works good thanks again.
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
MusoBob 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:59 AM.


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