|
|
|
06-14-2015, 01:41 PM
|
#1
|
Human being with feelings
Join Date: Jul 2014
Posts: 207
|
Load/Save Track state including FX with GetSetTrackState()
Hi! I want to do an A/B-script for a track or an FX. So I need to load/save Track state including any FX (in it's entirety).
I see one could use RPR_GetSetTrackState() in python for this.
I wonder, does this API function still have a data size limit on how large strings it can handle? And is it a good fit for this?
If EEL works better, I can use that too. Or as a last resort, C++, but I'd rather avoid it to save time.
Cheers,
Loops
Last edited by loopa; 06-14-2015 at 02:03 PM.
|
|
|
06-14-2015, 02:59 PM
|
#2
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by loopa
I wonder, does this API function still have a data size limit on how large strings it can handle? And is it a good fit for this?
|
Not if you use SWS API - with SWS installed, search the API documentation for WDL_FastString
|
|
|
06-15-2015, 01:42 AM
|
#3
|
Human being with feelings
Join Date: Jul 2014
Posts: 207
|
Thanks Breeder,
I'm gonna check it out! Is that C++ though? I'd love if possible to do in Python or EEL? (Or Lua?)
Cheers,
Loopas
|
|
|
06-15-2015, 01:53 AM
|
#4
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by loopa
Thanks Breeder,
I'm gonna check it out! Is that C++ though? I'd love if possible to do in Python or EEL? (Or Lua?)
Cheers,
Loopas
|
Nope, ReaScript...it just wraps WDL_FastString which you can then manipulate with SWS API. It definetly works in python, haven't tried with other ReaScript flavors.
|
|
|
06-15-2015, 01:12 PM
|
#5
|
Human being with feelings
Join Date: Jul 2014
Posts: 207
|
Hi again, sorry im a bit confused.
Should i then use this API-function to get the state?:
SNM_GetSetObjectState()
?
|
|
|
06-15-2015, 01:30 PM
|
#6
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by loopa
Hi again, sorry im a bit confused.
Should i then use this API-function to get the state?:
SNM_GetSetObjectState()
?
|
Yes!
Here's one my old scripts I used to toggle layouts using python and SNM chunk API
Code:
from reaper_python import *
from sws_python import *
import re
# If third layout is found, Layout1 gets applied
Layout1Name = '12 -- FX Rack'
Layout2Name = ''
Layout1Cmd = 41703 # Layout: apply custom layout #08
Layout2Cmd = 41697 # Layout: apply custom layout #02
def GetTrackChunk (track):
fs = SNM_CreateFastString("")
SNM_GetSetObjectState(track, fs, 0, 0)
chunk = SNM_GetFastString(fs)
SNM_DeleteFastString(fs)
if chunk:
return chunk
else:
return ''
def GetLayout (track, mcp):
chunk = GetTrackChunk(track)
input = re.findall("LAYOUTS.*",chunk)
if len(input) == 0:
return ''
else:
mode = 1 if mcp == False else 2
layout = (input[0].split(" \""))[mode]
layout = layout[0:-1] # Remove " from the end of the string
return layout
def SwitchLayouts (track, mcp):
layout = GetLayout(track, mcp)
cmd = 0
if len(layout) == 0: # no layout set
cmd = Layout1Cmd
else:
cmd = Layout2Cmd if layout == Layout1Name else Layout1Cmd
RPR_Main_OnCommand(cmd, 0)
if (RPR_CountTracks(0)):
SwitchLayouts(RPR_GetSelectedTrack(0, 0), True)
But ever since I exported additional SWS API, I've rewritten it for Lua so I don't know if it still works - it did with REAPER v4
|
|
|
06-16-2015, 03:17 AM
|
#7
|
Human being with feelings
Join Date: Jul 2014
Posts: 207
|
Nice! It worked perfectly to save/load track state!
I'm need to save/load only 1 FX of the track. Is it safe to extract/inject only the state string data for a single FX into the trach chunk? Seems to be the only way right?
Or this that perhaps frowned upon?
Thank you so much for all the help, btw!
Here's link to the other thread just in case:
http://forum.cockos.com/showthread.p...43#post1535243
Last edited by loopa; 06-16-2015 at 03:55 AM.
|
|
|
06-16-2015, 03:30 AM
|
#8
|
Human being with feelings
Join Date: Jul 2014
Posts: 207
|
Hi again! I'll post this as a new question (extract/inject plugin data into track chunk) in the Forum since I think it's different from the OP
|
|
|
08-31-2016, 01:07 PM
|
#9
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Quote:
Originally Posted by Breeder
Yes!
Here's one my old scripts I used to toggle layouts using python and SNM chunk API
Code:
from reaper_python import *
from sws_python import *
...
if (RPR_CountTracks(0)):
SwitchLayouts(RPR_GetSelectedTrack(0, 0), True)
But ever since I exported additional SWS API, I've rewritten it for Lua so I don't know if it still works - it did with REAPER v4
|
Do you have that LUA code? If I don't get my API request to load/save FXB's, I'm thinking I could compromise and load track state... a lot less flexible, but I think it would work.
|
|
|
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 06:18 AM.
|