Old 08-08-2020, 06:52 AM   #1
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default Track and envelope height

Is there a function that will allow me to set the track height and envelope Heights in code in the TCP? Thanks as always
Coachz is offline   Reply With Quote
Old 08-08-2020, 11:06 AM   #2
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

For setting the track height (and locking it) I use this:
Code:
    reaper.SetMediaTrackInfo_Value(track, "I_HEIGHTOVERRIDE", height);
    reaper.SetMediaTrackInfo_Value(track, "B_HEIGHTLOCK", LOCK_IT)
This is in Lua but looks the same in the other languages https://mespotin.uber.space/Ultrasch...rackInfo_Value

For envelope height I think you need to use SWS https://mespotin.uber.space/Ultrasch...vSetProperties
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 08-08-2020, 12:22 PM   #3
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Fabian View Post
For setting the track height (and locking it) I use this:
Code:
    reaper.SetMediaTrackInfo_Value(track, "I_HEIGHTOVERRIDE", height);
    reaper.SetMediaTrackInfo_Value(track, "B_HEIGHTLOCK", LOCK_IT)
This is in Lua but looks the same in the other languages https://mespotin.uber.space/Ultrasch...rackInfo_Value

For envelope height I think you need to use SWS https://mespotin.uber.space/Ultrasch...vSetProperties
Tha is Fabian! I'll give it a whirl.
Coachz is offline   Reply With Quote
Old 08-09-2020, 01:27 AM   #4
Win Conway
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,826
Default

Quote:
Originally Posted by Fabian View Post
For setting the track height (and locking it) I use this:
Code:
    reaper.SetMediaTrackInfo_Value(track, "I_HEIGHTOVERRIDE", height);
    reaper.SetMediaTrackInfo_Value(track, "B_HEIGHTLOCK", LOCK_IT)
This is in Lua but looks the same in the other languages https://mespotin.uber.space/Ultrasch...rackInfo_Value

For envelope height I think you need to use SWS https://mespotin.uber.space/Ultrasch...vSetProperties
How do you actually make that in to a usable script ?
__________________
Stop posting huge images, smaller images or thumbnail, it's not rocket science!
Win Conway is offline   Reply With Quote
Old 08-09-2020, 07:32 AM   #5
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

This seems to work here:

Code:
-- clear console
reaper.ShowConsoleMsg("")

-- create simpler console messager
function Msg(param)
    reaper.ShowConsoleMsg(param.."\n")
end

function bool2string(b) return b and "true" or "false" end 

debug  = true  -- disable main messages
--debug  = false  -- disable main messages

cntTracks = reaper.CountTracks( proj )
if debug then Msg("Num Tracks: " .. cntTracks) end

-- For each track
    for i = 0, cntTracks - 1 do

	 	local curTrack = reaper.GetTrack( 0, i )
	    retval, trackName = reaper.GetTrackName( curTrack, "" )
		if debug then Msg("\n Track Name: " .. i .. " is " .. trackName) end

		
       -- if track is track is selected 
       	selected =  reaper.IsTrackSelected( curTrack )
		if debug then Msg("\n Track is selected: " .. bool2string(selected)) end

		if selected then
			if debug then Msg("\nIn selected loop") end
			reaper.SetMediaTrackInfo_Value(curTrack, "I_HEIGHTOVERRIDE", 200)

			--include below line to lock track
			--reaper.SetMediaTrackInfo_Value(track, "B_HEIGHTLOCK", 1)
		end

    end

    reaper.TrackList_AdjustWindows( false )
    reaper.UpdateArrange()
Coachz is offline   Reply With Quote
Old 08-09-2020, 07:54 AM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

Quote:
Originally Posted by Win Conway View Post
How do you actually make that in to a usable script ?
Depends on what the script shall be useable in
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 08-09-2020, 08:32 AM   #7
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Depends on what the script shall be useable in
Not all of our brains run on machine language. :-)
Coachz is offline   Reply With Quote
Old 08-09-2020, 09:05 AM   #8
Win Conway
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,826
Default

It should be usable in Reaper, right?
Am I missing something?
__________________
Stop posting huge images, smaller images or thumbnail, it's not rocket science!
Win Conway is offline   Reply With Quote
Old 08-09-2020, 09:14 AM   #9
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Win Conway View Post
It should be usable in Reaper, right?
Am I missing something?
Here are two examples. Just load them in the actions window under new action / load reascript. It works on selected tracks

Last edited by Coachz; 08-15-2023 at 07:04 AM.
Coachz is offline   Reply With Quote
Old 08-09-2020, 11:56 AM   #10
Win Conway
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,826
Default

Thanks, much appreciated, I will see if I can understand any of the code itself (doubtful)
Thanks again
__________________
Stop posting huge images, smaller images or thumbnail, it's not rocket science!
Win Conway is offline   Reply With Quote
Old 08-09-2020, 12:46 PM   #11
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Win Conway View Post
Thanks, much appreciated, I will see if I can understand any of the code itself (doubtful)
Thanks again
Just ask me line by line what you don't get.
Coachz is offline   Reply With Quote
Old 08-09-2020, 02:24 PM   #12
Win Conway
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,826
Default

At work at the moment, but that's a great offer, thank you very much
__________________
Stop posting huge images, smaller images or thumbnail, it's not rocket science!
Win Conway is offline   Reply With Quote
Old 08-09-2020, 02:31 PM   #13
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

I need a way to reliably select the 1st envelope lane under the selected task if anyone knows how. This will allow me to set the env height there.
Coachz is offline   Reply With Quote
Old 08-09-2020, 03:50 PM   #14
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

You mean, select the first visible track envelope?
Code:
local env = reaper.GetTrackEnvelope(track, 0) -- first visible env
reaper.SetCursorContext(2, env) -- select the env
Edgemeal is offline   Reply With Quote
Old 08-10-2020, 09:56 AM   #15
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Edgemeal View Post
You mean, select the first visible track envelope?
Code:
local env = reaper.GetTrackEnvelope(track, 0) -- first visible env
reaper.SetCursorContext(2, env) -- select the env
You saved the day again. Thanks Edgemeal !
Coachz is offline   Reply With Quote
Old 08-15-2020, 07:03 AM   #16
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

I have one small wrinkle in the code I need help with please. It works for the volume envelope but it doesn't work for other envelopes. Their heights are not changed like the volume is.



Custom: Rotate Envelope Out of Lane
Envelope: Show all envelopes for tracks
Script: edgemeal_Toggle envelope lanes for selected track.lua
Script: JB_set_trk_ht_200.lua
Script: JB_select_first_visible_envelope.lua
Script: JB_set_envelope_height_500.lua
Script: JB_scroll_select_track_top.lua


Script: JB_set_envelope_height_500.lua has code
Code:
 -- clear console
reaper.ShowConsoleMsg("")

-- create simpler console messager
function Msg(param)
	reaper.ShowConsoleMsg(param.."\n")
end

debug  = false	-- disable main messages

envHeight = 500

tr = reaper.GetSelectedTrack( 0, 0 )
curMode = reaper.GetTrackAutomationMode( tr )


--if debug then Msg("Current Automation Mode is: " .. curMode) end

env = reaper.GetSelectedEnvelope( 0)


function SetEnvHeight(envelope, laneHeight)
local BR_env = reaper.BR_EnvAlloc( envelope, false )
local active, visible, armed, inLane, _, defaultShape, _, _, _, _, faderScaling = reaper.BR_EnvGetProperties( BR_env )
reaper.BR_EnvSetProperties( BR_env, active, visible, armed, inLane, laneHeight, defaultShape, faderScaling )
reaper.BR_EnvFree( BR_env, true )
end

SetEnvHeight(env, envHeight)

-- reaper.BR_EnvSetProperties(BR_Envelope envelope, boolean active, boolean
--visible, boolean armed, boolean inLane, integer laneHeight, integer
--defaultShape, boolean faderScaling)

Last edited by Coachz; 08-15-2023 at 07:04 AM.
Coachz is offline   Reply With Quote
Old 08-15-2020, 07:44 AM   #17
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,108
Default

From the gif it looks to me that when you bring the non-volume envelopes in the envelope lane, the volume envelope (green one in the media lane) is still selected, so this line

Quote:
env = reaper.GetSelectedEnvelope( 0)
still refers to the volume envelope and so fails for the others.
Not sure but maybe you need this to select/set focus to the target envelope first.

https://forum.cockos.com/showthread.php?t=212833 (post #7)
nofish is offline   Reply With Quote
Old 08-15-2020, 10:38 AM   #18
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

thanks nofish, I got lucky and found swapping

Script: edgemeal_Toggle envelope lanes for selected track.lua
for
Script: Toggle Envelope Lanes For Selected Track.lua

fixed it ! yay, thank you again for the help.
Coachz 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:40 PM.


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