-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUNDUPE 2.CAL
46 lines (41 loc) · 882 Bytes
/
UNDUPE 2.CAL
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
; UNDUPE.CAL
; (REVISED BY Rogério Dec - 08/28/2018)
; Remove duplicated events
; Maybe by Miguel Ratton
; prolog expression
(do
(int lastKind 0)
(dword lastTime 0)
(int lastKey 0)
(int nDeleted 0)
(int timeWindow 0)
(getInt timeWindow "Window for time identity:" 0 TIMEBASE)
(++ timeWindow)
(/= timeWindow 2)
)
; body expression - evaluated once for each selected event
(do
(if (== Event.Kind NOTE)
(do
(if (== lastKind Event.Kind)
(do
(if (&& (>= Event.Time (- lastTime timeWindow)) (<= Event.Time (+ lastTime timeWindow)))
(if (== Note.Key lastKey)
(do
(delete)
(++ nDeleted)
)
)
)
)
)
(= lastKey Note.Key)
)
)
(= lastKind Event.Kind)
(= lastTime Event.Time)
)
; epilog expression
(do
(pause "Deleted " nDeleted " duplicate events.")
)