comparison implementations/geerdes/constructors.lisp @ 298:204d6d1f4f6a

add composition slot to event (geerdes) Ignore-this: 7ece48560d6cc689711c5864e49a0360 darcs-hash:20090828164054-16a00-57b981532296c149640ab1e48439cdb88c41f2cf.gz
author j.forth <j.forth@gold.ac.uk>
date Fri, 28 Aug 2009 17:40:54 +0100
parents d1e5bbcc5ea4
children
comparison
equal deleted inserted replaced
297:6be947d9e7c3 298:204d6d1f4f6a
32 (%fast-patch row) 32 (%fast-patch row)
33 (%fast-channel row) 33 (%fast-channel row)
34 (%fast-track row) 34 (%fast-track row)
35 (%fast-onset row timebase) 35 (%fast-onset row timebase)
36 (%fast-duration row timebase) 36 (%fast-duration row timebase)
37 (%fast-id row)) 37 (%fast-id row)
38 composition)
38 (make-geerdes-percussive-event (%fast-pitch row) 39 (make-geerdes-percussive-event (%fast-pitch row)
39 (%fast-velocity row) 40 (%fast-velocity row)
40 (%fast-patch row) 41 (%fast-patch row)
41 (%fast-channel row) 42 (%fast-channel row)
42 (%fast-track row) 43 (%fast-track row)
43 (%fast-onset row timebase) 44 (%fast-onset row timebase)
44 (%fast-duration row timebase) 45 (%fast-duration row timebase)
45 (%fast-id row))))) 46 (%fast-id row)
47 composition))))
46 (when (%fast-monodyp row) 48 (when (%fast-monodyp row)
47 (let ((monody-note (copy-event note))) 49 (let ((monody-note (copy-event note)))
48 (setf (duration monody-note) (%fast-monody-duration row timebase)) 50 (setf (duration monody-note) (%fast-monody-duration row timebase))
49 (push monody-note monody-notes))) 51 (push monody-note monody-notes)))
50 (when (> (timepoint (cut-off note)) last-time) 52 (when (> (timepoint (cut-off note)) last-time)
127 (defun pitched-row-p (event-row) 129 (defun pitched-row-p (event-row)
128 (and (not (= (%fast-channel event-row) 10)) 130 (and (not (= (%fast-channel event-row) 10))
129 (< (%fast-patch event-row) 112))) 131 (< (%fast-patch event-row) 112)))
130 132
131 (defun make-geerdes-pitched-event (pitch-number velocity patch channel 133 (defun make-geerdes-pitched-event (pitch-number velocity patch channel
132 track onset duration event-id) 134 track onset duration event-id
135 composition)
133 (make-instance 'geerdes-pitched-event 136 (make-instance 'geerdes-pitched-event
134 :number pitch-number 137 :number pitch-number
135 :velocity velocity 138 :velocity velocity
136 :patch patch 139 :patch patch
137 :channel channel 140 :channel channel
138 :track track 141 :track track
139 :time onset 142 :time onset
140 :interval duration 143 :interval duration
141 :identifier (make-geerdes-event-identifier 144 :identifier (make-geerdes-event-identifier
142 event-id))) 145 event-id)
146 :composition composition))
143 147
144 (defun make-geerdes-percussive-event (pitch-number velocity patch 148 (defun make-geerdes-percussive-event (pitch-number velocity patch
145 channel track onset duration 149 channel track onset duration
146 event-id) 150 event-id composition)
147 (make-instance 'geerdes-percussive-event 151 (make-instance 'geerdes-percussive-event
148 :sound pitch-number 152 :sound pitch-number
149 :velocity velocity 153 :velocity velocity
150 :patch patch 154 :patch patch
151 :channel channel 155 :channel channel
152 :track track 156 :track track
153 :time onset 157 :time onset
154 :interval duration 158 :interval duration
155 :identifier (make-geerdes-event-identifier 159 :identifier (make-geerdes-event-identifier
156 event-id))) 160 event-id)
161 :composition composition))
157 162
158 (defmethod copy-event ((event geerdes-pitched-event)) 163 (defmethod copy-event ((event geerdes-pitched-event))
159 (with-slots ((channel amuse-midi::channel) 164 (with-slots ((channel amuse-midi::channel)
160 (track amuse-midi::track) 165 (track amuse-midi::track)
161 (number amuse::number) 166 (number amuse::number)
162 (time amuse::time) 167 (time amuse::time)
163 (interval amuse::interval) 168 (interval amuse::interval)
164 (velocity amuse-midi::velocity) 169 (velocity amuse-midi::velocity)
165 (patch amuse-midi::patch) 170 (patch amuse-midi::patch)
166 identifier) 171 identifier
172 composition)
167 event 173 event
168 (make-instance 'geerdes-pitched-event 174 (make-instance 'geerdes-pitched-event
169 :channel channel 175 :channel channel
170 :track track 176 :track track
171 :number number 177 :number number
172 :time time 178 :time time
173 :interval interval 179 :interval interval
174 :velocity velocity 180 :velocity velocity
175 :patch patch 181 :patch patch
176 :identifier identifier))) 182 :identifier identifier
183 :composition composition)))
177 184
178 (defmethod copy-event ((event geerdes-percussive-event)) 185 (defmethod copy-event ((event geerdes-percussive-event))
179 (with-slots ((channel amuse-midi::channel) 186 (with-slots ((channel amuse-midi::channel)
180 (track amuse-midi::track) 187 (track amuse-midi::track)
181 (time amuse::time) 188 (time amuse::time)
182 (interval amuse::interval) 189 (interval amuse::interval)
183 (velocity amuse-midi::velocity) 190 (velocity amuse-midi::velocity)
184 (patch amuse-midi::patch) 191 (patch amuse-midi::patch)
185 (sound amuse-midi::sound) 192 (sound amuse-midi::sound)
186 identifier) 193 identifier
194 composition)
187 event 195 event
188 (make-instance 'geerdes-percussive-event 196 (make-instance 'geerdes-percussive-event
189 :channel channel 197 :channel channel
190 :track track 198 :track track
191 :time time 199 :time time
192 :interval interval 200 :interval interval
193 :velocity velocity 201 :velocity velocity
194 :patch patch 202 :patch patch
195 :sound sound 203 :sound sound
196 :identifier identifier))) 204 :identifier identifier
205 :composition composition)))
197 206
198 ;; We want any function that generates a sequence from a geerdes 207 ;; We want any function that generates a sequence from a geerdes
199 ;; composition to preserve all slot values: 208 ;; composition to preserve all slot values:
200 #+nil 209 #+nil
201 (defmethod sequence:make-sequence-like :around ((o geerdes-composition) 210 (defmethod sequence:make-sequence-like :around ((o geerdes-composition)