Skip to content

Commit c93620b

Browse files
authored
Release Perfect Timing! - Audio Quantizer v0.32 (#1699)
- Improved grid drawing when using the internal Visualizer. - Fixed trigger line thickness to correctly correspond to quarter notes in the Edit window and the Visualizer.
1 parent 5eacd50 commit c93620b

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

Items Editing/80icio_Perfect Timing! - Audio Quantizer.lua

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
-- @description Perfect Timing! - Audio Quantizer
22
-- @author 80icio
3-
-- @version 0.31
4-
-- @changelog - FIxed detection with 1 bar and 1/2 bar grid settings when analyzed items start is not on the grid
3+
-- @version 0.32
4+
-- @changelog
5+
-- - Improved grid drawing when using the internal Visualizer.
6+
-- - Fixed trigger line thickness to correctly correspond to quarter notes in the Edit window and the Visualizer.
57
-- @link Forum thread https://forum.cockos.com/showthread.php?t=288964
68
-- @about
79
-- # PERFECT TIMING!
@@ -17,8 +19,7 @@
1719
-- * Multisized GUI
1820
-- * Works with fixed lanes
1921

20-
21-
-----------------------------vars vars vars!-----------------------------------
22+
------vars vars vars!-----------------------------------
2223
-------------------------------------------------------------------------------
2324
-------------------------------------------------------------------------------
2425
local r = reaper
@@ -1475,6 +1476,14 @@ end
14751476
---------------------------------reduce by grid ----------------------
14761477

14771478
function Create_Grid_table()
1479+
1480+
local function beatc(beatpos)
1481+
local retval, measures, cml, fullbeats, cdenom = r.TimeMap2_timeToBeats(0, beatpos)
1482+
local _, division, _, _ = r.GetSetProjectGrid(0,false)
1483+
beatpos = r.TimeMap2_beatsToTime(0, fullbeats +(division*2*(cdenom/4)))
1484+
return beatpos
1485+
end
1486+
14781487
grid_dist = (srate*(Gtolerance_v/1000))
14791488

14801489
local blockline = first_sel_item_start
@@ -1504,22 +1513,15 @@ function Create_Grid_table()
15041513
end
15051514
end
15061515

1507-
15081516
while (blockline <= first_sel_item_end) do
15091517

1510-
function beatc(beatpos)
1511-
local retval, measures, cml, fullbeats, cdenom = r.TimeMap2_timeToBeats(0, beatpos)
1512-
local _, division, _, _ = r.GetSetProjectGrid(0,false)
1513-
beatpos = r.TimeMap2_beatsToTime(0, fullbeats +(division*2*(cdenom/4)))
1514-
return beatpos
1515-
end
1516-
15171518
blockline = beatc(blockline)
1518-
1519+
local blocklineQN = r.TimeMap2_timeToQN( 0, blockline )
15191520
h = h + 1
15201521

15211522
Grid_blocks_Ruler[h] = floor(((blockline - first_sel_item_start)*srate))
1522-
if fmod(blockline,0.5) == 0 then
1523+
1524+
if abs(floor(blocklineQN)- blocklineQN)<1e-13 then
15231525
Grid_blocks_Ruler_thickness[h] = 2
15241526
else
15251527
Grid_blocks_Ruler_thickness[h] = 1
@@ -1583,10 +1585,11 @@ end
15831585
----------------------------------------------------------------------------------
15841586
function Trig_line_thickness(input)
15851587
QN_lineTHICK = {}
1586-
15871588
for i=1, #input, 2 do
1588-
local gridcheck = fmod(r.TimeMap2_timeToQN(0,(input[i]/first_srate)+ first_sel_item_start),1)
1589-
if gridcheck <= (divis*2) then
1589+
local gridcheck = r.TimeMap2_timeToQN(0,(input[i]/first_srate)+ first_sel_item_start)
1590+
gridcheck = abs(floor(gridcheck)-gridcheck)
1591+
1592+
if (gridcheck <= (divis*2) or gridcheck >= 1-(divis*2)) and GridScan then
15901593
QN_lineTHICK[i] = 2
15911594
else
15921595
QN_lineTHICK[i] = 1

0 commit comments

Comments
 (0)