|
|
|
04-15-2021, 10:27 AM
|
#1
|
Human being with feelings
Join Date: May 2006
Location: Surrey, UK
Posts: 19,677
|
Q: Get current value of envelope?
I am trying to get the current (at the play cursor or edit cursor position) value of an Automation Envelope
Code:
env_id = reaper.GetTrackEnvelopeByChunkName(track, "<VOLENV"
env_play = reaper.GetPlayPosition()
env_value = reaper.BR_EnvValueAtPos(env_id, reaper.GetPlayPosition()) +0.217
env_value2 = reaper.Envelope_FormatValue(env_id, env_value)
env_value is always 0.217 indicating that reaper.BR_EnvValueAtPos is always returning 0. "track" is a valid MediaTrack.
Any thoughts or suggestions?
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
|
|
|
04-15-2021, 10:48 AM
|
#2
|
Human being with feelings
Join Date: Jul 2009
Posts: 1,071
|
Use this ..
Code:
retval, value, dVdS, ddVdS, dddVdS = reaper.Envelope_Evaluate( envelope, time, samplerate, samplesRequested )
|
|
|
04-15-2021, 11:06 AM
|
#3
|
Human being with feelings
Join Date: May 2006
Location: Surrey, UK
Posts: 19,677
|
Thank you, I'll give that a try. I did see that one but all those D's and V's and S's put me off.
Do you know if reaper.BR_EnvValueAtPos() works at all?
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
Last edited by DarkStar; 04-15-2021 at 03:37 PM.
|
|
|
04-15-2021, 11:47 AM
|
#4
|
Human being with feelings
Join Date: Jul 2009
Posts: 1,071
|
Yes but you have to allocate the envelope with
reaper.BR_EnvAlloc( envelope, takeEnvelopesUseProjectTime )
with reaper.Envelope_Evaluate
you just need the return value so
Code:
retval, value, dVdS, ddVdS, dddVdS = reaper.Envelope_Evaluate( env, cursor_position, 0, 0 )
Last edited by J Reverb; 04-15-2021 at 12:28 PM.
|
|
|
04-15-2021, 01:41 PM
|
#5
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by J Reverb
Yes but you have to allocate the envelope with
reaper.BR_EnvAlloc( envelope, takeEnvelopesUseProjectTime )
|
Just to add, and call BR_EnvFree when done, otherwise you'd create a memory leak.
|
|
|
04-15-2021, 03:38 PM
|
#6
|
Human being with feelings
Join Date: May 2006
Location: Surrey, UK
Posts: 19,677
|
Thank you, guys.
That sounds messy. But reaper.Envelope_Evaluate() worked, once I has qorkws out what the parameters were and where to get them from
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
|
|
|
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:59 AM.
|