RPR GetSetEnvelopeState
From CockosWiki
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetSetEnvelopeState
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetSetEnvelopeState
Contents |
GetSetEnvelopeState()
bool GetSetEnvelopeState(TrackEnvelope* env, char* str, int maxlen)
This function gets or sets the state of an envelope as an xml/rpp chunk. A "chunk" is some XML-like text, there are some examples on the page: VOLENV, VOLENV2 etc.
Set the str parameter to "" when calling this function to get the envelope state returned in str (in the return array).
The returned state string is limited to maxlen characters
Set the str parameter to an xml/rpp string when calling this function to set the object state.
Parameters
TrackEnvelope* env, Pointer to a valid envelope char* str, Set to "" to read current state - or to a string to set the state to that string int maxlen Maximum length of str parameter, restricted to <= 1MB
Returns
An array, containing bool returns true on success TrackEnvelope* env, copied from Parameters char* str, Either copied from Parameters (from a Set call) or read from state of the envelope as a result of a Get call int maxlen copied from Parameters
Envelope Definitions
The comments in the envelope definitions below are for illustration only, comments are not allowed in rpp chunks. The internal envelopes are VOLENV, VOLENV2, PANENV, PANENV2 and MUTEENV. Their maximum and minimum values are implicit. Plugin parameters (PARMENV) have their minimum and maximum defined in the state. The maximum and minimum of the internal envelope types are below.
VOLENV and VOLENV2 have a maximum of 2.0 and a minimum of 0.0
PANENV and PANENV2 have a maximum of 1.0 and a minimum of -1.0.
MUTEENV has a maximum of 1.0 and a minimum of 0.0.
VOLENV2
A VOLENV2 envelope is part of a Track.
<VOLENV2 // Envelope start & name ACT 1 // Envelope Active, 1=true, 0=false (bypassed) VIS 1 1 1.000000 // Visibility -> // field 1, int, ?? // field 2, int, ?? // field 3, float, ?? LANEHEIGHT 0 0 // Height of the Envelope Lane ARM 1 // Envelope Armed, 1=true, 0=false DEFSHAPE 0 // Default shape of envelope -> 0 = Linear // 1 = Square // 2 = Slow Start/End // 3 = Fast Start // 4 = Fast End // 5 = Bezier PT 1.250000 1.818182 5 // Envelope points -> PT 1.770000 1.309091 5 // field 1, float, timeline position (seconds) PT 1.830000 1.636364 5 // field 2, float, value PT 1.930000 1.736364 5 // field 2, int, point shape (see DEFSHAPE above) > // Envelope end
PARMENV
Although PARMENV pertains to Plug-ins, I believe the data below might further specify some of the VOLENV parameters, above. Can anyone fill in the **don't know** values?
<PARMENV 1 0.000000 1469.000000 734.500000 // 0-based parameter index, VST top-to-bottom // minimum value // maximum value // neutral or zero value ACT 1 // active? boolean 1/0 VIS 1 1 1.000000 // visible? boolean 1/0 // automation in separate lane/media lane? boolean 1/0 // float: **don't know** LANEHEIGHT 24 0 // 1st value: if zero, then lane height determined by track height // otherwise, lane height // 2nd value: **don't know** ARM 1 // armed? boolean 1/0 DEFSHAPE 0 // default envelope shape; // 0: linear // 1: square // 2: slow start/end // 3: fast start // 4: fast end // 5: bezier PT 0.000000 8.000000 0 0 1 // 1st value: time // 2nd value: parameter value // 3rd value: envelope shape // 4th value unknown, always seems to be zero (possible delmitter for selected value?) // selected? if not selected then this value and the 4th value are not here unless bezier tension is set (see next point) PT 1.000000 8.000000 5 0 0 0 -0.69600 // 1st value: time // 2nd value: parameter value // 3rd value: envelope shape: (5=bezier) // 4th value: unknown, always seems to be zero (possible delmitter for selected value?) // 5th value: selected? not selected // 6th value: unknown, always seems to be zero (possible delmitter for bezier tension value?) // 7th value: bezier tension. Always between -1.0 and 1.0. PT 4.031554 44.000000 0 PT 5.969200 40.063492 0 >
TEMPOENVEX
These are on the master track; they store tempo change information.
<TEMPOENVEX ACT 1 VIS 1 0 1.000000 LANEHEIGHT 0 0 ARM 0 DEFSHAPE 1 PT 16.800000000000 100.0000000000 1 524294 // 1st value: location on timeline // 2nd value: bpm // 3rd value: If 1, square shape (no linear increase in tempo to next pt). if 0, increase // tempo linearly to next tempo pt // 4th value: time signature, first 3 digits are denominator, last 3 are numerator // denom: 8388 = 128th, 4194 = 64th, 2097 = 32nd, 1048 = 16th, 524 = 8th, 262 = quarter, 131 = half, 65 = whole // num: starts at different value for each denom, then increments as numerator increments // In above order, starts from: 609; 305; 153; 577; 289; 145; 073; 537 PT 27.600000000000 140.0000000000 1 262148 >
Examples
C++
Perl
# # GetTrackEnvelope.pl # use strict; use warnings; use Win32::Clipboard; my $Clipboard = Win32::Clipboard(); # MediaTrack* GetSelectedTrack(ReaProject* proj, int seltrackidx) # TrackEnvelope* GetTrackEnvelope(MediaTrack* track, int envidx) # bool GetSetEnvelopeState(TrackEnvelope* env, char* str, int maxlen) use constant CURR_PROJ => 0; use constant FIRST => 0; use constant MAX_LEN => (16 * 1024); my $tr; my $te; my $result; my $chunk; $tr = RPR_GetSelectedTrack(CURR_PROJ, FIRST); unless($tr){ $Clipboard -> Set("GetSelectedTrack() failed."); exit; } $te = RPR_GetTrackEnvelope($tr, FIRST); unless($te){ $Clipboard -> Set("GetTrackEnvelope() failed."); exit; } ($result, undef, $chunk, undef) = RPR_GetSetEnvelopeState($te, "", MAX_LEN); unless($te){ $Clipboard -> Set("GetSetEnvelopeState() failed."); exit; } else { $Clipboard -> Set($chunk); }
Python
# define msg alias (custom) def msg(m): RPR_ShowConsoleMsg(m+'\n') envstr = '' maxlen = 256 trkptr = RPR_GetSelectedTrack( 0, 0 ) envptr = RPR_GetTrackEnvelopeByName( trkptr, 'Burns: Delay 0' ) # valid = RPR_ValidatePtr( envptr, 'TrackEnvelope*') # msg( str(valid) ) envstate = RPR_GetSetEnvelopeState( envptr, envstr, maxlen) msg( str(envstate[2]) )
See Also
get set state: GetSetEnvelopeState, GetSetItemState, GetSetTrackState
envelope: GetEnvelopeName, GetSelectedTrackEnvelope, GetSetEnvelopeState, GetTakeEnvelopeByName, GetTrackEnvelope, GetTrackEnvelopeByName, CountTrackEnvelopes,
(Section automatically generated, edits may be overwritten.)
Stuff
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetSetEnvelopeState
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetSetEnvelopeState