-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
X-Raym_Set selected tempo envelope points value.lua
78 lines (54 loc) · 1.89 KB
/
X-Raym_Set selected tempo envelope points value.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--[[
* ReaScript Name: Set selected tempo envelope points value
* About: Pop up to adjust multiple tempo envelope points
* Author: X-Raym
* Author URI: https://www.extremraym.com
* Repository: GitHub > X-Raym > REAPER-ReaScripts
* Repository URI: https://github.com/X-Raym/REAPER-ReaScripts
* Licence: GPL v3
* REAPER: 5.0
* Version: 1.0
]]
--[[
* Changelog:
* v1.0 (2017-07-17)
+ Initial Release
]]
-- USER CONFIG AREA ---------------------------------------------
-- Do you want a pop up to appear ?
prompt = true -- true/false
-- Define here your default variables values
bpm_target = 120
-----------------------------------------------------------------
function Main()
points_id = {}
for i = 0, reaper.CountEnvelopePoints( env ) - 1 do
retval, time, value, shape, tension, selected = reaper.GetEnvelopePoint( env, i )
if selected then table.insert(points_id, i) end
end
for j, ptidx in ipairs( points_id ) do
retval, timepos, measurepos, beatpos, bpm, timesig_num, timesig_denom, lineartempo = reaper.GetTempoTimeSigMarker( 0, ptidx )
test = reaper.SetTempoTimeSigMarker( 0, ptidx, timepos, measurepos, beatpos, bpm_target, timesig_num, timesig_denom, lineartempo )
end
end
env = reaper.GetSelectedEnvelope( 0 )
if env then
retval, env_name = reaper.GetEnvelopeName( env, '' )
if env_name == "Tempo map" then
if prompt == true then
retval, retval_csv = reaper.GetUserInputs("Tempo points value", 1, "BPM", bpm_target)
bpm_target = tonumber(retval_csv)
end
if retval or prompt == false then
if bpm_target then -- if user complete the fields
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
Main()
reaper.UpdateArrange()
reaper.UpdateTimeline()
reaper.Undo_EndBlock( "Set selected tempo envelope points value", - 1 )
reaper.PreventUIRefresh(-1)
end
end
end
end