delete events while maintaining other start-times?
Rick Taube
hkt@cmp-nxt1.music.uiuc.edu
Mon, 2 Dec 1996 07:55:23 -0600
this function will delete and expunge muted objects and update times in the
remaining objects. you need to install the mute.lisp patch before using.
(defun flush-muted (thread &aux last)
(run-object thread 0)
(map-object #'(lambda (o)
(if (mutedp o) (delete-object o)
(if last
(setf (object-rhythm last)
(- (object-time o) (object-time last))
last o)
(setf last o))))
thread)
(expunge-object thread)
thread)
;;;-------------
Stella [Top-Level]: tlist aaa 0
Aaa
0.00 1. #<MIDI-NOTE | 60| 1| 1| 64| 0|>
1.00 2. #<MIDI-NOTE | 61| 1| 1| 64| 0|>
2.00 3. #<MIDI-NOTE | 62| 1| 1| 64| 0|>
3.00 4. #<MIDI-NOTE | 63| 1| 1| 64| 0|>
4.00 5. #<MIDI-NOTE | 64| 1| 1| 64| 0|>
5.00 6. #<MIDI-NOTE | 65| 1| 1| 64| 0|>
6.00 7. #<MIDI-NOTE | 66| 1| 1| 64| 0|>
7.00 8. #<MIDI-NOTE | 67| 1| 1| 64| 0|>
8.00 9. #<MIDI-NOTE | 68| 1| 1| 64| 0|>
9.00 10. #<MIDI-NOTE | 69| 1| 1| 64| 0|>
Stella [Top-Level]: map aaa[::2] mute $
Stella [Top-Level]: (flush-muted #!aaa)
#<THREAD: Aaa>
Stella [Top-Level]: tlist aaa 0
Aaa
0.00 1. #<MIDI-NOTE | 61| 2| 2| 64| 0|>
2.00 2. #<MIDI-NOTE | 63| 2| 2| 64| 0|>
4.00 3. #<MIDI-NOTE | 65| 2| 2| 64| 0|>
6.00 4. #<MIDI-NOTE | 67| 2| 2| 64| 0|>
8.00 5. #<MIDI-NOTE | 69| 1| 1| 64| 0|>
Stella [Top-Level]: