reaper-oss / sws

The SWS extension is a collection of features that seamlessly integrate into REAPER, the Digital Audio Workstation (DAW) software by Cockos, Inc
https://www.sws-extension.org/
MIT License
455 stars 85 forks source link

reaper.BR_EnvSetProperties doesn't apply #1859

Closed MathieuCGit closed 8 months ago

MathieuCGit commented 8 months ago

Hello,

I wrote a function but reaper.BR_EnvSetProperties doesn't seem to apply lane height parameter :

--- Set the height of all visible envelope for track passed in argument
--@tparam tr track is the reaper track you want to set envelopes height
--@tparam height int is the height you want to assign to each envelope of tr
function set_env_h_per_tr(tr, height)
    nbr_env= reaper.CountTrackEnvelopes(tr)
    if nbr_env > 0 then
        --for each envelope on the track we get its height
        for i=0, nbr_env-1 do
            env= reaper.GetTrackEnvelope( tr, i)
            br_env=reaper.BR_EnvAlloc( env, true )
            active, visible, armed, inLane, _, defaultShape, _, _, _, _, faderScaling, automationItemsOptions = reaper.BR_EnvGetProperties( br_env )
            if inLane and visible then
                reaper.BR_EnvSetProperties( br_env, active, visible, armed, inLane, height, defaultShape, faderScaling, automationItemsOptionsIn )
            end
            --free ressource, as indicate by reaper.BR_EnvAlloc documentation
            reaper.BR_EnvFree( bf_env, true )
        end
    end
end

Is it a real issue or may I missed something ?

Buy-One commented 8 months ago

Let me plug a feature request here Envelope visibility, armed, bypass state, height attributes for GetEnvelopeInfo_Value() which you may want to support

MathieuCGit commented 8 months ago

Let me plug a feature request here Envelope visibility, armed, bypass state, height attributes for GetEnvelopeInfo_Value() which you may want to support

hmmm, I may misunderstood your query, but it seems it's actually already possible to get envelope lane height with reaper.GetEnvelopeInfo_Value( env, "I_TCPH")

but, yes, it would be nice to have a native support for other aspects of envelope. BTW Im' not sure this is the right place to discuss this ^_^'

Buy-One commented 8 months ago

Indeed, my mistake, overlooked this attribute.

MathieuCGit commented 8 months ago

I plus your feature request and add this functionality to the reaper API whislist : https://forum.cockos.com/showthread.php?t=48871&page=11

Buy-One commented 8 months ago

Thank you

MathieuCGit commented 8 months ago

may be this issue is related to the new option in reaper 7 preferences > appararence > zoom/scroll/offset > Envelope lane vertical zoom ?

cfillion commented 8 months ago

The snippet has a typo: s/bf_env/br_env/.

MathieuCGit commented 8 months ago

Hello cfillion,

Thanks a tons for the code error, the power of open source at work :) and sorry for the noise >_<'