Open nofishonfriday opened 6 years ago
BR_Envelope::Build seems to be the function needing an update to include points from AIs.
Unless we update BR_GetMouseCursorContext to have a unique context for AIs instead of being just "envelope" (#915)? No idea what the best way to do that would be though.
Thanks @cfillion.
Unless we update BR_GetMouseCursorContext to have a unique context for AIs instead of being just "envelope" (#915)?
Actually I (tried to) start working on this when I noticed it's currently broken for envelope points in AI. The logic for AI detection could be s.th. like this I thought: If (mouse cursor within AI) and not (mouse cursor over env_segment or env_point) => details_out = automation_item. (last priority check, so to say). Early test:
The "good thing" with this approach would be that env_point and env_segment detection wouldn't need to change to distinct if they are within AI or not. What do you and the others think ?
edit: Current relevant REAPER bug: https://forum.cockos.com/showthread.php?t=199142
(I'd expect that native API functions CountEnvelopePoints() and GetEnvelopePoint() which BR_Envelope::Build() uses would work as they did before the introduction of AI's when this bug is fixed, otherwise it would break all older scripts using this, so it would also fix this issue 'by itself'. But let's see how it goes. Anyway I'll halt further work on this until it's fixed in REAPER.)
Thanks for the thumbs up btw. :)
CountEnvelopePointsEx() is fixed in R5.78pre1. Also needs fixing in SWS though as CountEnvelopePoints() still only returns nr. of points outside AIs. I guess we'd now have to loop through all AIs to count all points on an envelope (inluding those in AIs) ?
Fix approach pushed, seems to work but not totally happy regarding efficiency (see my comment). If anyone has ideas for something better I'm all ears. :)
It doesn't look too bad to me. Perhaps sorting can be avoided if there is no AIs?
Good point, I'll put that in, thanks. Not too happy about the nested loop to get all points in AIs either (edit: O(N2) ! :D), but seems there's no other way ? Meanwhile I've also asked in the scripers forum, let's see if other ideas come up: https://forum.cockos.com/showthread.php?t=204337
If not, I think we may go with this...
It's not as straight forward as I initially thought. Seems like BR_Envelope::Commit() would also need a rather big rewrite to account for AIs. Closing the related PR (#967) as it's not merge-ready.
Hello, I would like to use the details output of BR_GetMouseCursorContext to act on envelope points in AIs. Any news on this?
In AI's it returns env_segment when it should return env_point.
Test script I'm using: