Old 08-04-2017, 02:27 PM   #1
Outboarder
Human being with feelings
 
Outboarder's Avatar
 
Join Date: Feb 2014
Posts: 834
Default GetProjExtState() Chunk voodoo

Hi

Is there a document that shows how to get the desired value out of GetProjExtState chunk (for example Project samplerate) ?

Here all is written about GetProjExtState in Reascript document:

Code:
SetProjExtState() and GetProjExtState() allow ReaScripts to save data within the project RPP file.
And in the API:

Code:
C: int GetProjExtState(ReaProject* proj, const char* extname, const char* key, char* valOutNeedBig, int valOutNeedBig_sz)

EEL: int GetProjExtState(ReaProject proj, "extname", "key", #valOutNeedBig)

Lua: integer retval, string valOutNeedBig reaper.GetProjExtState(ReaProject proj, string extname, string key)

Python: (Int retval, ReaProject proj, String extname, String key, String valOutNeedBig, Int valOutNeedBig_sz) = RPR_GetProjExtState(proj, extname, key, valOutNeedBig, valOutNeedBig_sz)

Get the value previously associated with this extname and key, the last time the project was saved. See SetProjExtState, EnumProjExtState.
It doesn't tell how to use it!

The question:

I want to get the project samplerate ,there is no API function to return it directly but I know you can do it by filtering the GetProjExtState chunk but I don't know how.

Could someone give me an overview how to get project samplerate ?

Thank you
__________________
Outboarder Scripts
Outboarder is offline   Reply With Quote
Old 08-04-2017, 04:27 PM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

It's just for storing and loading your own custom data. As far as I know, it can't be used to access any "magic" settings specific to Reaper itself.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 08-04-2017, 05:15 PM   #3
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

For projet sample rate you can use parse_timestr_length to see duration of one sample. Then divide one by the value and you should have samplerate !
X-Raym is offline   Reply With Quote
Old 08-04-2017, 08:33 PM   #4
Outboarder
Human being with feelings
 
Outboarder's Avatar
 
Join Date: Feb 2014
Posts: 834
Default

Code:
ProjectSampleRate = 1 / reaper.parse_timestr_len( 1, 0, 4 )
Thank you Xraym, that worked.

still eager to know how to use GetProjExtState for further use. many parameters are only accessible via GetProjExtState.
__________________
Outboarder Scripts
Outboarder is offline   Reply With Quote
Old 08-05-2017, 03:20 AM   #5
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Outboarder View Post
[CODE]

still eager to know how to use GetProjExtState for further use. many parameters are only accessible via GetProjExtState.
GetProjExtState can only be used for writing and loading your script's custom state, not for Reaper specific state.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 08-05-2017 at 04:06 AM.
Xenakios is offline   Reply With Quote
Old 08-05-2017, 08:04 AM   #6
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

By the way, if you have the SWS extension installed, this should work with Lua ReaScript :

Code:
local sr = reaper.SNM_GetIntConfigVar("projsrate", 0)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 08-05-2017, 10:12 AM   #7
Outboarder
Human being with feelings
 
Outboarder's Avatar
 
Join Date: Feb 2014
Posts: 834
Default

Code:
local sr = reaper.SNM_GetIntConfigVar("projsrate", 0)
Thanks Xenakios, that works too.
__________________
Outboarder Scripts
Outboarder is offline   Reply With Quote
Old 08-05-2017, 10:56 AM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,108
Default

Quote:
Originally Posted by Xenakios View Post
By the way, if you have the SWS extension installed, this should work with Lua ReaScript :

Code:
local sr = reaper.SNM_GetIntConfigVar("projsrate", 0)
I tried this too when I saw this thread, but how do you know to use "projsrate" here (and the keywords for the other project settings for that matter) ? I tried with "SAMPLERATE" as it occurs in the .rpp but that obviously didn't work.
nofish is offline   Reply With Quote
Old 08-05-2017, 12:40 PM   #9
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by nofish View Post
I tried this too when I saw this thread, but how do you know to use "projsrate" here (and the keywords for the other project settings for that matter) ? I tried with "SAMPLERATE" as it occurs in the .rpp but that obviously didn't work.
Reverse engineered from the Reaper process memory (With Process Explorer)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 08-05-2017, 03:50 PM   #10
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,108
Default

Nice tip, thanks.
nofish is offline   Reply With Quote
Old 08-05-2017, 04:30 PM   #11
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Nice tip! Thanks!

This is a list of the values that one can get:
Code:
acidimport
adjreclat
adjrecmanlat
adjrecmanlatin
afxcfg
allstereopairs
altpeaks
altpeaksopathlist
altpeakspath
alwaysallowkb
applyfxtail
audioasync
audiocloseinactive
audioclosestop
audioprshift
autoclosetrackwnds
automute
automuteflags
automuteval
autonbworkerthreads
autoreturntime
autoreturntime_action
autosaveint
autosavemode
autoxfade
bigwndframes
ccresettab
cpuallowed
csurfrate
ctrlcopyitem
defautomode
defenvs
deffadelen
deffadeshape
defhwvol
defpitchcfg
defrecpath
defrenderpath
defsavepath
defsendflag
defsendvol
defsplitxfadelen
deftrackrecflags
deftrackrecinput
deftrackvol
defvzoom
defxfadeshape
disabledxscan
disk_peakmmap2
disk_rdblksex
disk_rdmodeex
disk_rdsizeex
disk_wrblks
disk_wrblks2
disk_wrmode
disk_wrsize
diskcheckmb
edit_fontsize
env_autoadd
env_deffoc
env_ol_minh
env_options
envlanes
envtranstime
envtrimadjmode
envwritepasschg
errnowarn
fadeeditflags
fadeeditlink
fadeeditpostsel
fadeeditpresel
feedbackmode
fxdenorm
fxresize
g_config_project
g_markerlist_updcnt
griddot
gridinbg
gridinbg2
groupdispmode
guidelines2
handzoom
hwfadex
ide_colors
insertmtrack
itemdblclk
itemeditpr
itemfade_minheight
itemfade_minwidth
itemfadehandle_maxwidth
itemfxtail
itemicons
itemicons_minheight
itemlabel_minheight
itemlowerhalf_minheight
itemmixflag
itemprops
itemprops_timemode
itemsnap
itemtimelock
itemvolmode
lazyupds
loadlastproj
loopclickmode
loopgran
loopgranlen
loopnewitems
loopselpr
loopstopfx
manuallat
manuallatin
mastermutesolo
maxitemlanes
maxrecent
maxrecentfx
maxrecsize
maxrecsize_use
maxsnaptrack
metronome_defout
metronome_flags
midiccdensity
mididefcolormap
midiedit
midieditor
midiins
midiins_cs
midilatmask
midioctoffs
midiouts
midiouts_clock
midiouts_clock_nospp
midiouts_llmode
midioutthread
midisendflags
miditicksperbeat
midivu
mixeruiflag
mixrowflags
mousemovemod
mousewheelmode
multitouch
multitouch_ignore_ms
multitouch_ignorewheel_ms
multitouch_rotate_gear
multitouch_swipe_gear
multitouch_zoom_gear
mutefadems10
mvu_rmsgain
mvu_rmsmode
mvu_rmsoffs2
mvu_rmsred
mvu_rmssize
nativedrawtext
newfnopt
newprojdo
newprojtmpl
newtflag
norunmute
offlineinact
opencopyprompt
opennotes
optimizesilence
pandispmode
panlaw
panmode
peakcachegenmode
peakcachegenrs
peakrecbm
peaksedges
pitchenvrange
playcursormode
playrate
playresamplemode
pmfol
prebufperb
prerollmeas
projalignbeatsrate
projbpm
projdefrecpath
projdefrecpath2
projfrbase
projfrdrop
projgriddiv
projgriddivsnap
projgridframe
projgridmin
projgridsnapmin
projgridswing
projgroupover
projgroupsel
projintmix
projmasternch
projmastervuflags
projmaxlen
projmaxlenuse
projmeaslen
projmeasoffs
projmetrobeatlen
projmetrocountin
projmetroen
projmetrof1
projmetrof2
projmetrofn1
projmetrofn2
projmetropattern
projmetrov1
projmetrov2
projmidieditor
projpeaksgain
projrecforopencopy
projrecmode
projrelpath
projrelsnap
projrenderaddtoproj
projrenderdither
projrenderlimit
projrendernch
projrenderqdelay
projrenderrateinternal
projrenderresample
projrendersrate
projrenderstems
projripedit
projsellock
projshowgrid
projsmpteahead
projsmptefw_rec
projsmpteinput
projsmptemaxfree
projsmpteoffs
projsmpterate
projsmpterateuseproj
projsmpteresync
projsmpteresync_rec
projsmpteskip
projsmptesync
projsrate
projsrateuse
projtakelane
projtimemode
projtimemode2
projtimeoffs
projtrackgroupdisabled
projtsdenom
projvidflags
projvidh
projvidw
promptendrec
psmaxv
psminv
quantflag
quantolms
quantolms2
quantsize2
reamote_maxblock
reamote_maxlat_render
reamote_maxpkt
reamote_smplfmt
reascripttimeout
recaddatloop
reccfg
recfile_wildcards
recopts
recupdatems
relsnap
renderaheadlen
renderaheadlen2
renderbsnew
rendercfg
renderclosewhendone
renderqdelay
rendertail
rendertaillen
rendertails
resetvuplay
restrictcpu
reuseeditor
rewireslave
rewireslavedelay
reximport
rfprojfirst
rightclickemulate
ripplelockmode
rulerlabelmargin
runafterstop
sampleedges
saveopts
saveundostatesproj
scnameedit
scnotes
scoreminnotelen
scorequant
screenset_as_views
screenset_as_win
screenset_autosave
scrubloopend
scrubloopstart
scrubmode
scrubrelgain
seekmodes
selitem_tintalpha
selitemtop
showlastundo
showmaintrack
showpeaksbuild
showrecitems
slidermaxv
sliderminv
slidershex
smoothseekmeas
snapextrad
snapextraden
solodimdb10
soloip
specpeak_alpha
specpeak_bv
specpeak_ftp
specpeak_hueh
specpeak_huel
specpeak_lo
specpeak_na
stopprojlen
syncsmpmax2
syncsmpuse
tabtotransflag
tcpalign
tempoenvmax
tempoenvmin
tempoenvtimelock
textflags
threadpr
timeseledge
tinttcp
titlebarreghide
tooltipdelay
trackitemgap
trackselonmouse
tsmarker
uiflags
uiscale
undomask
undomaxmem
unselitem_tintalpha
use_reamote
usedxplugs
useinnc
userewire
verchk
video_colorspace
video_decprio
video_delayms
volenvrange
vstbr32
vstfolder_settings
vstfullstate
vuclipstick
vudecay
vumaxvol
vuminvol
vuupdfreq
vzoom2
vzoommode
warnmaxramW64
workbehvr
workbuffxuims
workbufmsex
workrender
workset_max
workset_min
workset_use
workthreads
zoom
zoommode
zoomshowarm
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 08-05-2017, 05:01 PM   #12
Outboarder
Human being with feelings
 
Outboarder's Avatar
 
Join Date: Feb 2014
Posts: 834
Default

Quote:
Originally Posted by amagalma View Post
Nice tip! Thanks!

This is a list of the values that one can get:
Code:
acidimport
adjreclat
adjrecmanlat
adjrecmanlatin
afxcfg
allstereopairs
altpeaks
altpeaksopathlist
altpeakspath
alwaysallowkb
applyfxtail
audioasync
audiocloseinactive
audioclosestop
audioprshift
autoclosetrackwnds
automute
automuteflags
automuteval
autonbworkerthreads
autoreturntime
autoreturntime_action
autosaveint
autosavemode
autoxfade
bigwndframes
ccresettab
cpuallowed
csurfrate
ctrlcopyitem
defautomode
defenvs
deffadelen
deffadeshape
defhwvol
defpitchcfg
defrecpath
defrenderpath
defsavepath
defsendflag
defsendvol
defsplitxfadelen
deftrackrecflags
deftrackrecinput
deftrackvol
defvzoom
defxfadeshape
disabledxscan
disk_peakmmap2
disk_rdblksex
disk_rdmodeex
disk_rdsizeex
disk_wrblks
disk_wrblks2
disk_wrmode
disk_wrsize
diskcheckmb
edit_fontsize
env_autoadd
env_deffoc
env_ol_minh
env_options
envlanes
envtranstime
envtrimadjmode
envwritepasschg
errnowarn
fadeeditflags
fadeeditlink
fadeeditpostsel
fadeeditpresel
feedbackmode
fxdenorm
fxresize
g_config_project
g_markerlist_updcnt
griddot
gridinbg
gridinbg2
groupdispmode
guidelines2
handzoom
hwfadex
ide_colors
insertmtrack
itemdblclk
itemeditpr
itemfade_minheight
itemfade_minwidth
itemfadehandle_maxwidth
itemfxtail
itemicons
itemicons_minheight
itemlabel_minheight
itemlowerhalf_minheight
itemmixflag
itemprops
itemprops_timemode
itemsnap
itemtimelock
itemvolmode
lazyupds
loadlastproj
loopclickmode
loopgran
loopgranlen
loopnewitems
loopselpr
loopstopfx
manuallat
manuallatin
mastermutesolo
maxitemlanes
maxrecent
maxrecentfx
maxrecsize
maxrecsize_use
maxsnaptrack
metronome_defout
metronome_flags
midiccdensity
mididefcolormap
midiedit
midieditor
midiins
midiins_cs
midilatmask
midioctoffs
midiouts
midiouts_clock
midiouts_clock_nospp
midiouts_llmode
midioutthread
midisendflags
miditicksperbeat
midivu
mixeruiflag
mixrowflags
mousemovemod
mousewheelmode
multitouch
multitouch_ignore_ms
multitouch_ignorewheel_ms
multitouch_rotate_gear
multitouch_swipe_gear
multitouch_zoom_gear
mutefadems10
mvu_rmsgain
mvu_rmsmode
mvu_rmsoffs2
mvu_rmsred
mvu_rmssize
nativedrawtext
newfnopt
newprojdo
newprojtmpl
newtflag
norunmute
offlineinact
opencopyprompt
opennotes
optimizesilence
pandispmode
panlaw
panmode
peakcachegenmode
peakcachegenrs
peakrecbm
peaksedges
pitchenvrange
playcursormode
playrate
playresamplemode
pmfol
prebufperb
prerollmeas
projalignbeatsrate
projbpm
projdefrecpath
projdefrecpath2
projfrbase
projfrdrop
projgriddiv
projgriddivsnap
projgridframe
projgridmin
projgridsnapmin
projgridswing
projgroupover
projgroupsel
projintmix
projmasternch
projmastervuflags
projmaxlen
projmaxlenuse
projmeaslen
projmeasoffs
projmetrobeatlen
projmetrocountin
projmetroen
projmetrof1
projmetrof2
projmetrofn1
projmetrofn2
projmetropattern
projmetrov1
projmetrov2
projmidieditor
projpeaksgain
projrecforopencopy
projrecmode
projrelpath
projrelsnap
projrenderaddtoproj
projrenderdither
projrenderlimit
projrendernch
projrenderqdelay
projrenderrateinternal
projrenderresample
projrendersrate
projrenderstems
projripedit
projsellock
projshowgrid
projsmpteahead
projsmptefw_rec
projsmpteinput
projsmptemaxfree
projsmpteoffs
projsmpterate
projsmpterateuseproj
projsmpteresync
projsmpteresync_rec
projsmpteskip
projsmptesync
projsrate
projsrateuse
projtakelane
projtimemode
projtimemode2
projtimeoffs
projtrackgroupdisabled
projtsdenom
projvidflags
projvidh
projvidw
promptendrec
psmaxv
psminv
quantflag
quantolms
quantolms2
quantsize2
reamote_maxblock
reamote_maxlat_render
reamote_maxpkt
reamote_smplfmt
reascripttimeout
recaddatloop
reccfg
recfile_wildcards
recopts
recupdatems
relsnap
renderaheadlen
renderaheadlen2
renderbsnew
rendercfg
renderclosewhendone
renderqdelay
rendertail
rendertaillen
rendertails
resetvuplay
restrictcpu
reuseeditor
rewireslave
rewireslavedelay
reximport
rfprojfirst
rightclickemulate
ripplelockmode
rulerlabelmargin
runafterstop
sampleedges
saveopts
saveundostatesproj
scnameedit
scnotes
scoreminnotelen
scorequant
screenset_as_views
screenset_as_win
screenset_autosave
scrubloopend
scrubloopstart
scrubmode
scrubrelgain
seekmodes
selitem_tintalpha
selitemtop
showlastundo
showmaintrack
showpeaksbuild
showrecitems
slidermaxv
sliderminv
slidershex
smoothseekmeas
snapextrad
snapextraden
solodimdb10
soloip
specpeak_alpha
specpeak_bv
specpeak_ftp
specpeak_hueh
specpeak_huel
specpeak_lo
specpeak_na
stopprojlen
syncsmpmax2
syncsmpuse
tabtotransflag
tcpalign
tempoenvmax
tempoenvmin
tempoenvtimelock
textflags
threadpr
timeseledge
tinttcp
titlebarreghide
tooltipdelay
trackitemgap
trackselonmouse
tsmarker
uiflags
uiscale
undomask
undomaxmem
unselitem_tintalpha
use_reamote
usedxplugs
useinnc
userewire
verchk
video_colorspace
video_decprio
video_delayms
volenvrange
vstbr32
vstfolder_settings
vstfullstate
vuclipstick
vudecay
vumaxvol
vuminvol
vuupdfreq
vzoom2
vzoommode
warnmaxramW64
workbehvr
workbuffxuims
workbufmsex
workrender
workset_max
workset_min
workset_use
workthreads
zoom
zoommode
zoomshowarm
Hail to you, Now I can rest peacefully.
__________________
Outboarder Scripts
Outboarder is offline   Reply With Quote
Old 08-06-2017, 06:43 AM   #13
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,108
Default

Yeah, very useful list, thanks amagalma.
nofish is offline   Reply With Quote
Old 08-06-2017, 11:13 AM   #14
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Added in Reapack Templates repo.

ReaScripts-Templates/SNM_GetIntConfigVar.lua at master · ReaTeam/ReaScripts-Templates
X-Raym is offline   Reply With Quote
Old 11-22-2018, 07:59 AM   #15
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,108
Default

Quote:
Originally Posted by Xenakios View Post
By the way, if you have the SWS extension installed, this should work with Lua ReaScript :

Code:
local sr = reaper.SNM_GetIntConfigVar("projsrate", 0)
I'm revisiting this because I got unexpected results using the above.
It seems this returns the value set in 'Project Settings -> Project sample rate' which is not necessarily the actual current project sample rate, but only when the corresponding tickbox is ticked, i.e. projsrateuse == 1

https://github.com/Ultraschall/ultra...tion.txt#L4719

So the snippet posted by Outboarder seems more save to me when wanting to get the current actual project sampling rate.
nofish is offline   Reply With Quote
Old 07-26-2021, 02:16 AM   #16
Hypex
Human being with feelings
 
Join Date: Mar 2015
Location: Australia
Posts: 452
Default

Just been testing this in EEL. Seems it's more limited for some reason. On top of other limitations. The variables tempoenvmax and tempoenvmin work but tempoenvtimelock doesn't. This is with get_config_var_string(). Tested with LUA and doesn't work either. What gives? :-?
Hypex 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 06:42 AM.


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