Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Tempo Envelope - select env point under edit cursor v1.0 #1403

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- @description Tempo Envelope - select env point under edit cursor
-- @author Audiobabble
-- @version 1.0
-- @about Selects the master track tempo envelope point currently under the cursor, regardless of focus on other envelopes in the project

tr = reaper.GetMasterTrack( 0 )
env = reaper.GetTrackEnvelopeByName( tr, 'Tempo map' )
curpos = reaper.GetCursorPosition()

-- function for rounding to x decimal places
function round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end


-- Main Script
for ptidx=1,reaper.CountTempoTimeSigMarkers( 0 ) do
-- get all envelope points in tempo map
_, timeIn, valueIn, shapeIn, tensionIn, _ = reaper.GetEnvelopePoint(env, ptidx)
if round(curpos, 2) == round(timeIn, 2) then
-- if at cursor then select
reaper.SetEnvelopePoint(env, ptidx, timeIn, valueIn, shapeIn, tensionIn, true)
end
end
reaper.UpdateTimeline()