# HG changeset patch # User Jamie Forth # Date 1296041428 0 # Node ID 1f3873585a5d8ca38fdf973c691c5608e63b1844 # Parent 5ff310be494254300efcda8f07b22810d5c89adb Change midifile-import to call event constructors, not make-instance directly. diff -r 5ff310be4942 -r 1f3873585a5d implementations/midi/constructors.lisp --- a/implementations/midi/constructors.lisp Wed Jan 26 10:44:29 2011 +0000 +++ b/implementations/midi/constructors.lisp Wed Jan 26 11:30:28 2011 +0000 @@ -14,10 +14,10 @@ :time onset :interval duration)) -(defun make-midi-percussive-event (pitch-number velocity patch +(defun make-midi-percussive-event (sound velocity patch channel track onset duration) (make-instance 'midi-percussive-event - :sound pitch-number + :sound sound :velocity velocity :patch patch :channel channel diff -r 5ff310be4942 -r 1f3873585a5d implementations/midi/methods.lisp --- a/implementations/midi/methods.lisp Wed Jan 26 10:44:29 2011 +0000 +++ b/implementations/midi/methods.lisp Wed Jan 26 11:30:28 2011 +0000 @@ -59,27 +59,19 @@ ;; FIXME: This ought to call-next-method and operate on the result, ;; rather than calling internals from the other package (defmethod copy-event ((event midi-pitched-event)) - (with-slots (channel track (number amuse::number) (time amuse::time) (interval amuse::interval) velocity patch) - event - (make-instance 'midi-pitched-event - :channel channel - :track track - :number number - :time time - :interval interval - :velocity velocity - :patch patch))) + (with-slots (channel track (number amuse::number) + (time amuse::time) (interval amuse::interval) + velocity patch) event + (make-midi-pitched-event number velocity patch channel track time + interval))) + (defmethod copy-event ((event midi-percussive-event)) - (with-slots (channel track (time amuse::time) (interval amuse::interval) velocity patch sound) - event - (make-instance 'midi-percussive-event - :channel channel - :track track - :time time - :interval interval - :velocity velocity - :patch patch - :sound sound))) + (with-slots (channel track (time amuse::time) + (interval amuse::interval) velocity patch + sound) event + (make-midi-percussive-event sound velocity patch channel track + time interval))) + (defgeneric copy-time-signature (time-signature)) (defmethod copy-time-signature ((time-signature standard-time-signature)) (make-instance (class-of time-signature) @@ -342,4 +334,4 @@ ((time>= period2 (cut-off period1)) (return-from %find-overlapping (reverse result-list))) ((time> (cut-off period2) period1) - (push period2 result-list)))))) \ No newline at end of file + (push period2 result-list)))))) diff -r 5ff310be4942 -r 1f3873585a5d implementations/midi/midifile-import.lisp --- a/implementations/midi/midifile-import.lisp Wed Jan 26 10:44:29 2011 +0000 +++ b/implementations/midi/midifile-import.lisp Wed Jan 26 11:30:28 2011 +0000 @@ -139,23 +139,21 @@ ((or (= (midi:message-channel note-on) 9) (> patch 111)) ;; percussive - (make-instance 'midi-percussive-event - :channel (1+ (midi:message-channel note-on)) - :track track - :time (/ (midi:message-time note-on) divisions) - :interval (/ (- cut-off (midi:message-time note-on)) - divisions) - :velocity (midi:message-velocity note-on) - :patch patch - :sound (midi:message-key note-on))) + (make-midi-percussive-event (midi:message-key note-on) + (midi:message-velocity note-on) + patch + (1+ (midi:message-channel note-on)) + track + (/ (midi:message-time note-on) divisions) + (/ (- cut-off (midi:message-time note-on)) + divisions))) (t ;; pitched - (make-instance 'midi-pitched-event - :channel (1+ (midi:message-channel note-on)) - :track track - :time (/ (midi:message-time note-on) divisions) - :interval (/ (- cut-off (midi:message-time note-on)) - divisions) - :velocity (midi:message-velocity note-on) - :patch patch - :number (midi:message-key note-on))))) + (make-midi-pitched-event (midi:message-key note-on) + (midi:message-velocity note-on) + patch + (1+ (midi:message-channel note-on)) + track + (/ (midi:message-time note-on) divisions) + (/ (- cut-off (midi:message-time note-on)) + divisions)))))