Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 04-18-2017, 08:22 AM   #1
crabfists
Human being with feelings
 
Join Date: Apr 2017
Posts: 3
Default Moving envelope points when item position is modified with SetMediaItemInfo_Value

I have a custom C++ action that moves items around using SetMediaItemInfo_Value() passing "D_POSITION" as param name.

Is there a way to get the envelope points to automatically move with the item like they do when you drag the item manually? (providing the "Envelope points move with media items option is turned on).

Thanks in advance!
crabfists is offline   Reply With Quote
Old 04-18-2017, 08:33 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Perhaps ApplyNudge will work better than directly changing the item position. (Despite the function name, it can also be used to set some of the item properties directly instead of nudging.)
__________________
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 04-18-2017, 08:42 AM   #3
crabfists
Human being with feelings
 
Join Date: Apr 2017
Posts: 3
Default

Thanks Xenakios, will try ApplyNudge()
crabfists is offline   Reply With Quote
Old 04-18-2017, 10:54 AM   #4
crabfists
Human being with feelings
 
Join Date: Apr 2017
Posts: 3
Default

So, I had a quick test with ApplyNudge() and it does indeed let you set the position of all selected items, moving envelope points too. What I can't figure out is how I can just apply a nudge to a single item. Is this possible?

I would like to be able to iterate through all selected items and nudge the position of each one to an arbitrary (and unique) offset. I use this algorithm to sort items by a specific sort criteria.

I could see a way to make ApplyNudge() work for a single item at a time but it would be a massive kludge. I could store the selected items in a list, unselect them, then select each one at a time and call ApplyNudge() on it. Feels nasty though.

Last edited by crabfists; 04-18-2017 at 12:39 PM.
crabfists is offline   Reply With Quote
Old 04-20-2017, 02:14 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 crabfists View Post
I could store the selected items in a list, unselect them, then select each one at a time and call ApplyNudge() on it. Feels nasty though.
Sometimes you will just have to accept having to do things like that with the Reaper API.
__________________
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
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 12:21 PM.


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