changeset 203:23b97270de8b

Changes to gsharp import to accommodate mensural notation. N.B. This won't work without my branch of GSharp committer: David Lewis <d.lewis@gold.ac.uk>
author David Lewis <david@localhost.localdomain>
date Wed, 08 Sep 2010 13:06:57 +0100
parents 3e7b33ae3a0d
children 10d47e78a53d
files implementations/gsharp/gsharp-import.lisp
diffstat 1 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/implementations/gsharp/gsharp-import.lisp	Wed Sep 08 13:06:57 2010 +0100
+++ b/implementations/gsharp/gsharp-import.lisp	Wed Sep 08 13:06:57 2010 +0100
@@ -36,15 +36,27 @@
 	sum (gsharp-buffer:duration (gsharp-buffer:cluster n))))
 
 (defun events-from-element (element index time)
-  (when (typep element 'gsharp-buffer:cluster)
-    (mapcar (lambda (note)
-	      (make-instance 'gsharp-pitched-event
-			     :note note
-                 :slice-index index
-			     :number (gsharp-play::midi-pitch note)
-			     :time time
-			     :interval (* 4 (compute-duration note))))
-	    (remove-if #'gsharp-buffer:tie-left (gsharp-buffer:notes element)))))
+  (cond 
+    ((typep element 'gsharp-buffer:cluster)
+     (mapcar (lambda (note)
+               (make-instance 'gsharp-pitched-event
+                              :note note
+                              :slice-index index
+                              :number (gsharp-play::midi-pitch note)
+                              :time time
+                              :interval (* 4 (compute-duration note))))
+             (remove-if #'gsharp-buffer:tie-left (gsharp-buffer:notes element))))
+    ((typep element 'gsharp-buffer::mensural-element)
+     (mapcan (lambda (note)
+               (prog1
+                   (make-instance 'gsharp-pitched-event
+                                     :note note
+                                     :slice-index index
+                                     :number (gsharp-play::midi-pitch note)
+                                     :time time
+                                     :interval (* 4 (compute-duration note)))
+                 (incf time (* 4 (compute-duration note)))))
+             (gsharp-buffer::contents element)))))
 
 (defun events-from-bar (bar index time)
   (mapcan (lambda (element)