; UNDOUBLE.CAL
;
; 把这段程序存成.cal就可以用了。^-^
; body expression
(do
(int CurrentKey 0)
(int DeletedNotes 0)
(dword ExpiryTime 0)
(while (< CurrentKey 128)
(do
(= ExpiryTime 0)
(message "UnDoubling Note: " CurrentKey " Deleted: " DeletedNotes)
(forEachEvent
(if (&& (== Event.Kind NOTE) (== Note.Key CurrentKey))
(do
(if (<= Event.Time ExpiryTime)
(do
(delete)
(++ DeletedNotes)
)
(do
(= ExpiryTime (+ Note.Dur Event.Time))
)
)
)
NIL
)
)
(++ CurrentKey)
)
)
(if (== DeletedNotes 0)
(pause "No doubled/overlapping notes found!")
(pause DeletedNotes " doubled/overlapping notes deleted.")
)
)
; epilog expression
(do
NIL
)