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

Reply
 
Thread Tools Display Modes
Old 03-09-2024, 07:15 AM   #1
Zly
Human being with feelings
 
Join Date: Dec 2023
Posts: 2
Default How to properly add Envelope Points into a created Pooled Automation Item?

How do I put enveloper points into pooled Automation Items?

Every time I try to do it, they are either:
1. Doesn't add the points.
2. Adds them, but upon moving the Items, the points literally delete themselves. Which makes no sense at all...

It only works if I don't pool the Automation Items, which in my case is not a good thing to do, makes my resulting envelopes inconvenient to use.

How do I properly do it? I tried many ways, and it's just so frustrating at this point that something this simple just doesn't work...

Here's an example of how I try to do it:

Code:
for index = 0, items_count - 1 do
    local item	   = reaper.GetSelectedMediaItem(0, index)
    local item_pos = reaper.GetMediaItemInfo_Value(item, "D_POSITION")
    local item_len = reaper.GetMediaItemInfo_Value(item, "D_LENGTH")

    -- returns from 0 to 1.
    local evaluated_point = found_preset(index, item)

    local ai_index = reaper.InsertAutomationItem(
        envelope,
        index % 2 + 1, -- is either 1 or 2, so we have only two pools
        item_pos, item_len
    )

    -- create points only for first two Automation Items,
    -- because we only have two pools.
    if index <= 1 then 
        reaper.InsertEnvelopePointEx(
            -- env
            envelope,
            -- autoitem_idx
            index % 2 + 1,  -- is ALSO either 1 or 2
            -- pos, val
            item_pos + item_len / 2, evaluated_point,
            -- shape, tension
            1, 1,
            -- isSelected, noSort
            false, true
        )
    end
end

Last edited by Zly; 03-09-2024 at 07:38 AM.
Zly is offline   Reply With Quote
Old 03-11-2024, 09:19 AM   #2
Zly
Human being with feelings
 
Join Date: Dec 2023
Posts: 2
Default nvm i figured it.

Apparently, enabling `noSort` will break the envelope, even if you sort them after the process.
Zly 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:56 AM.


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