Old 09-07-2018, 04:01 PM   #1
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 945
Default AI & BR_EnvSetProperties bug (FIXED)

Enable Options: Automation items connect to the underlying envelope on both sides
Create AI from envelope like shown in the gif.

Bug #1: After creating AI the envelope points are not updated correctly unless you move/resize the AI (or use a script that resizes the envelope but that causes bug #2).

Bug #2: Now run a script that resizes the envelope lane and notice the second point in the envelope disappears!



Scripts used,
mpl_Minimize all tracks envelopes heights
SWS/wol: Set selected envelope height to minimum

Not sure what SWS uses but mpl's script uses reaper.BR_EnvSetProperties to change envelope size, both caused a point to go missing.


Win7 / v5.50c, v5.941, 5.95rc1 / x64
Attached Files
File Type: rpp IA bug Connect to both sides.RPP (3.1 KB, 66 views)

Last edited by Edgemeal; 02-08-2019 at 12:48 PM.
Edgemeal is offline   Reply With Quote
Old 09-07-2018, 04:09 PM   #2
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 22,379
Default

That'd be a SWS related issue, since it's using an API call done by Breeder within SWS.
EvilDragon is offline   Reply With Quote
Old 09-07-2018, 04:12 PM   #3
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 945
Default

Ah right, I was thinking that was a reaper API, sorry!

Bug #1 is still valid.

Last edited by Edgemeal; 09-07-2018 at 04:23 PM. Reason: typo
Edgemeal is offline   Reply With Quote
Old 01-08-2019, 03:04 PM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 945
Default

Update:
Can't reproduce this on v5.965, but if I load the attached project which was created in v5.941 the bug is still there. I've been really worried about using SWS envelope resizing actions ever since, I guess it was just a bug in v5.941 that caused it?
Edgemeal is offline   Reply With Quote
Old 01-13-2019, 09:22 AM   #5
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,397
Default

I can reproduce bug #2 from scratch in a new project (Reaper 5.965 Win x64, SWS 2.9.8)



Yes, it's triggered by SWS functionality ('SWS/wol: Set selected envelope height to minimum' also uses Breeder Envelope functions internally), but I'm not sure if something in API functionality has changed since the introduction of AIs. To my understanding the BR Envelope functionality in SWS 2.9.8 works on the underlying envelope only and should work as before the introduction of AIs (just leaving AIs out).

The (most) relevant bits of code:
BR_Envelope::Build(), BR_Envelope::Commit()

So not sure currently if this needs fixing in SWS or something in Reaper (API functionality) could be done about it.

Last edited by nofish; 01-13-2019 at 10:57 AM.
nofish is offline   Reply With Quote
Old 01-13-2019, 10:26 AM   #6
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 945
Default

Thanks for testing!

Just to add, the last test I did I was counting the envelope points before and after the SWS (v2.9.7) call, and the count was the same, so the points weren't getting deleted as I thought but rather moving to where (under?) the AI was so I couldn't see them.
Edgemeal is offline   Reply With Quote
Old 01-14-2019, 06:17 PM   #7
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,397
Default

What's happening here doesn't seem quite right to me, but maybe I just don't understand how the API is supposed to work.



Script I used:
https://gist.github.com/nofishonfrid...376688ff7b7e85
(REAPER v5.965, 'Automation items connect to the underlying envelope on both sides' enabled)

Last edited by nofish; 01-14-2019 at 06:46 PM.
nofish is offline   Reply With Quote
Old 01-17-2019, 10:59 AM   #8
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,468
Default

It looks like the envelope API adds some sort of "virtual point" at the AI boundaries when they are connected to the underlying envelope. This confuses SWS.

Parsing the envelope chunk seems to be the only solution since the API is lying about the true envelope contents... Here's a test build that should address this: https://cfillion.ca/files/sws/fix-br...-connected-ai/. (Comments in the existing code suggests this way is slower, but I haven't measured. EDIT: It's indeed a slower, but should be negligible for real-life sized envelopes, < 250k points.)

Last edited by cfillion; 01-24-2019 at 11:02 AM.
cfillion is online now   Reply With Quote
Old 01-17-2019, 11:06 AM   #9
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,468
Default

Test setup showing the API returning fake points:



When "Options: Automation items connect to the underlying envelope on both sides" (or right side) is disabled, everything is fine:

Code:
> reaper.CountEnvelopePoints(env)
2
> reaper.GetEnvelopePoint(env, 0)
{true, 0.0, 1.0, 0, 0.0, false}
> reaper.GetEnvelopePoint(env, 1)
{true, 1.0, 1.0, 0, 0.0, false}
> reaper.GetEnvelopePoint(env, 2)
{false, 0.0, 0.0, 0, 0.0, false}
When either option is enabled, the API returns two additional points at the AI boundaries (which are not in the actual envelope chunk):
Code:
> reaper.CountEnvelopePoints(env)
4
> reaper.GetEnvelopePoint(env, 0)
{true, 0.0, 1.0, 0, 0.0, false}
> reaper.GetEnvelopePoint(env, 1)
{true, 1.0, 1.0, 0, 0.0, false}
> reaper.GetEnvelopePoint(env, 2)
{true, 2.0, 1.0, 0, 0.0, false}
> reaper.GetEnvelopePoint(env, 3)
{true, 4.0, 1.0, 0, 0.0, false}
> reaper.GetEnvelopePoint(env, 4)
{false, 0.0, 0.0, 0, 0.0, false}

Last edited by cfillion; 01-17-2019 at 11:33 AM.
cfillion is online now   Reply With Quote
Old 02-03-2019, 09:41 AM   #10
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 945
Default

Finally tried this again (bug #2) using SWS 2.1, seems OK now!

SWS v2.10.0 pre-release / REAPER 5.965 / Windows 7 / x64
Edgemeal is offline   Reply With Quote
Old 02-08-2019, 06:49 AM   #11
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,397
Default

Yes, fixed in SWS v2.10.0 pre-release.
Quote:
Issue 1086: Fix envelope reconstitution when automation items are connected to the underlying envelope
nofish 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 06:04 AM.


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