comparison implementations/midi/midifile-import.lisp @ 206:1f3873585a5d

Change midifile-import to call event constructors, not make-instance directly.
author Jamie Forth <j.forth@gold.ac.uk>
date Wed, 26 Jan 2011 11:30:28 +0000
parents 4a0e15e2829a
children 619194befdd4
comparison
equal deleted inserted replaced
205:5ff310be4942 206:1f3873585a5d
137 (defun make-event-from-on-off-pair (note-on cut-off divisions track patch) 137 (defun make-event-from-on-off-pair (note-on cut-off divisions track patch)
138 (cond 138 (cond
139 ((or (= (midi:message-channel note-on) 9) 139 ((or (= (midi:message-channel note-on) 9)
140 (> patch 111)) 140 (> patch 111))
141 ;; percussive 141 ;; percussive
142 (make-instance 'midi-percussive-event 142 (make-midi-percussive-event (midi:message-key note-on)
143 :channel (1+ (midi:message-channel note-on)) 143 (midi:message-velocity note-on)
144 :track track 144 patch
145 :time (/ (midi:message-time note-on) divisions) 145 (1+ (midi:message-channel note-on))
146 :interval (/ (- cut-off (midi:message-time note-on)) 146 track
147 divisions) 147 (/ (midi:message-time note-on) divisions)
148 :velocity (midi:message-velocity note-on) 148 (/ (- cut-off (midi:message-time note-on))
149 :patch patch 149 divisions)))
150 :sound (midi:message-key note-on)))
151 (t 150 (t
152 ;; pitched 151 ;; pitched
153 (make-instance 'midi-pitched-event 152 (make-midi-pitched-event (midi:message-key note-on)
154 :channel (1+ (midi:message-channel note-on)) 153 (midi:message-velocity note-on)
155 :track track 154 patch
156 :time (/ (midi:message-time note-on) divisions) 155 (1+ (midi:message-channel note-on))
157 :interval (/ (- cut-off (midi:message-time note-on)) 156 track
158 divisions) 157 (/ (midi:message-time note-on) divisions)
159 :velocity (midi:message-velocity note-on) 158 (/ (- cut-off (midi:message-time note-on))
160 :patch patch 159 divisions)))))
161 :number (midi:message-key note-on)))))