changeset 207:6ba20759e8f3

Merge branch 'master' of ssh://git-isms.doc.gold.ac.uk/isms/group/muthic/git/amuse
author David Lewis <d.lewis@gold.ac.uk>
date Wed, 16 Feb 2011 09:25:15 +0000
parents 3d4ea9a18040 (current diff) 1f3873585a5d (diff)
children 41a5aca81030 7e2d0b5a5e35
files
diffstat 4 files changed, 35 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/base/methods.lisp	Wed Feb 16 09:24:29 2011 +0000
+++ b/base/methods.lisp	Wed Feb 16 09:25:15 2011 +0000
@@ -407,8 +407,10 @@
 
 (defmethod during ((object1 anchored-period)
 		   (object2 anchored-period))
-  (and (time> object1 object2)
-       (time< (cut-off object2) (cut-off object2))))
+  (or (and (time> object1 object2)
+	   (time<= (cut-off object1) (cut-off object2)))
+      (and (time>= object1 object2)
+	   (time< (cut-off object1) (cut-off object2)))))
 
 (defmethod starts ((object1 anchored-period)
 		   (object2 anchored-period))
--- a/implementations/midi/constructors.lisp	Wed Feb 16 09:24:29 2011 +0000
+++ b/implementations/midi/constructors.lisp	Wed Feb 16 09:25:15 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
--- a/implementations/midi/methods.lisp	Wed Feb 16 09:24:29 2011 +0000
+++ b/implementations/midi/methods.lisp	Wed Feb 16 09:25:15 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))))))
--- a/implementations/midi/midifile-import.lisp	Wed Feb 16 09:24:29 2011 +0000
+++ b/implementations/midi/midifile-import.lisp	Wed Feb 16 09:25:15 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)))))