Old 12-14-2009, 04:51 PM   #1
cturner
Human being with feelings
 
cturner's Avatar
 
Join Date: Apr 2009
Location: GWB
Posts: 76
Default Accessing array data in TrackEnvelope pointer?

OK, I'm sure this is some simple Python thing. I've looked around the forum, but can't find anything about this. I know about pointers passed as parameters, but this isn't a case, correct?

Code:
track = RPR_GetSelectedTrack( 0, 0 )
envelope = RPR_GetTrackEnvelopeByName( track, 'Volume' )
valid = RPR_ValidatePtr( envelope, 'TrackEnvelope*')
msg( str(valid) )
AFAIK, I've got a valid Track Envelope pointer here, but I can't for the life of me access the data. I get the string "(TrackEnvelope*)0x13F229AC" and envelope[0] is equal to '('



Any help appreciated!

Charles

Latest Reaper OSX
cturner is offline   Reply With Quote
Old 12-14-2009, 05:04 PM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by cturner View Post
OK, I'm sure this is some simple Python thing. I've looked around the forum, but can't find anything about this. I know about pointers passed as parameters, but this isn't a case, correct?

Code:
track = RPR_GetSelectedTrack( 0, 0 )
envelope = RPR_GetTrackEnvelopeByName( track, 'Volume' )
valid = RPR_ValidatePtr( envelope, 'TrackEnvelope*')
msg( str(valid) )
AFAIK, I've got a valid Track Envelope pointer here, but I can't for the life of me access the data. I get the string "(TrackEnvelope*)0x13F229AC" and envelope[0] is equal to '('



Any help appreciated!

Charles

Latest Reaper OSX
You can't access and modify the raw data of the envelopes unfortunately. You will need to use the API function

bool GetSetEnvelopeState(TrackEnvelope* env, char* str, int maxlen)

to get the envelope's state as a text chunk (formatted the same as the envelopes in the .rpp files) and then do your operations on that, and finally use GetSetEnvelopeState again to update the envelope in Reaper.
__________________
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 12-14-2009, 05:27 PM   #3
cturner
Human being with feelings
 
cturner's Avatar
 
Join Date: Apr 2009
Location: GWB
Posts: 76
Default

Thanks so much for your speedy reply, Xenakios. It does indeed work:

Code:
(1, '(TrackEnvelope*)0x13F229AC', '<VOLENV2\nACT 1\nVIS 1 1 1.000000\nLANEHEIGHT 236 0\nARM 1\nDEFSHAPE 0\nPT 0.000000 1.000000 0\nPT 2.000000 1.649123 0\nPT 2.970000 1.570175 5 0 1\nPT 3.490000 1.640351 0\nPT 4.000000 1.578947 0\nPT 4.670000 1.342105 0\nPT 5.250000 1.000000 0\n>\n', 256)
Saved me a lot of looking through the ctypes documentation to see if there was some some of conversion function. <blush>

(Props for all the contributions you've made to Reaper, BTW!)

Best, Charles
cturner 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 04:55 PM.


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