|
|
|
06-20-2021, 08:56 PM
|
#1
|
Human being with feelings
Join Date: Jan 2014
Posts: 5,220
|
Where's a 'how to' for GetTrackStateChunk
Reascript API tells me nothing and I can't find anything on the forums or google searches.
I can't figure out what I'm supposed to do with this function, but it seems to be the answer to all things 'is this track x or not'. o.o
|
|
|
06-21-2021, 12:58 AM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Working with Statechunks is fiddly, so the easiest way to work with them is to use Ultraschall-Api for this.
In Ultraschall-Api, I have added tons of functions, that allow passing a statechunk as parameter to get and to set the values in there.
For instance, if you want to get and set the current trackheight of a TrackStateChunk, you can use GetTrackHeightState and SetTrackHeightState:
https://mespotin.uber.space/Ultrasch...ackHeightState
https://mespotin.uber.space/Ultrasch...ackHeightState
You get a TrackStateChunk with reaper.GetTrackStateChunk and you can commit a TrackStateChunk back into a track with reaper.SetTrackStateChunk.
The functions of Ultraschall-Api who probably support TrackStateChunks begin with GetTrackXXX and SetTrackXXX, where XXX is the name of the state.
Look in the functionindex in the docs for Track Management -> Get Track States and Set Track States for a list of them.
https://mespotin.uber.space/Ultrasch...Functions.html
If you have a specific statechunk-entry you want to get/set, you can also look for the statechunk-entry's name in the docs, for instance TRACKHEIGHT to find the functions, who deal with the TRACKHEIGHT-statechunk-entry.
|
|
|
06-21-2021, 03:11 AM
|
#3
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
There are actually quite some scriprs and threads about Track Chunk,
it is just a way to get ALL the tracks infos and its items in a string format for quick search/replace/manipulation, if more regular reascript API function doesnt exists or would be too slows for some reason.
It is well documented: https://github.com/ReaTeam/Doc/blob/...%20Definitions
Take inspiration from existing scriprs shared via reapack for eg.
The question is more... what are you trying to achieve ?
|
|
|
06-21-2021, 09:06 PM
|
#4
|
Human being with feelings
Join Date: Jan 2014
Posts: 5,220
|
There were only 6 forum threads before mine and they were all very specific questions about how it works, but not how to use it. The ultraschall-api looks to be the most intelligent, thank you!
I would not have known what to look for to find the state chunk list on GitHub
Looking to do actions to tracks which have a certain record arm state and pass some other conditions.
|
|
|
06-21-2021, 10:47 PM
|
#5
|
Human being with feelings
Join Date: Jan 2014
Posts: 5,220
|
Using something like GetTrackRecState, how do I return all the variables and not just the first one?
Similarly, how can I use SetTrackRecState without setting all the variables?
|
|
|
06-22-2021, 02:55 AM
|
#6
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
Using the forum native search function, you will surely got more threads speaking about this, though indeed most of them are very specific :
https://forum.cockos.com/search.php?searchid=15403459
If you only need track property check, Track Chunk will be overkill, as this cna be several MB long, where property are oftenjust few bytes.
Simply use : GetMediaTrackInfo_Value(track, param) function.
Track state will be "I_RECARM" property.
|
|
|
06-22-2021, 03:42 AM
|
#7
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by Fergler
Using something like GetTrackRecState, how do I return all the variables and not just the first one?
Similarly, how can I use SetTrackRecState without setting all the variables?
|
You put more variables before it:
A, B, C, D, E = functionname()
In statechunks, you always need to set all of them, if you want to change one value, so the functions work the same.
So you always need to use the get-function first, then change the value in need, then setting them again with the set-function.
Last edited by Meo-Ada Mespotine; 06-22-2021 at 03:49 AM.
|
|
|
06-22-2021, 02:51 PM
|
#8
|
Human being with feelings
Join Date: Jan 2014
Posts: 5,220
|
Quote:
Originally Posted by Meo-Ada Mespotine
You put more variables before it:
A, B, C, D, E = functionname()
In statechunks, you always need to set all of them, if you want to change one value, so the functions work the same.
So you always need to use the get-function first, then change the value in need, then setting them again with the set-function.
|
That makes sense, thank you so much. Script is getting closer to reality now.
|
|
|
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 02:50 AM.
|