changeset 133:d041118612d4

Fixed monody import for geerdes darcs-hash:20070821110338-f76cc-6958b98c5ece929c14f7faa5bc837810254621b9.gz
author David Lewis <d.lewis@gold.ac.uk>
date Tue, 21 Aug 2007 12:03:38 +0100
parents bfe5afcad183
children 5e362d998f29
files implementations/geerdes/constructors.lisp implementations/geerdes/methods.lisp
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/implementations/geerdes/constructors.lisp	Mon Aug 20 15:44:32 2007 +0100
+++ b/implementations/geerdes/constructors.lisp	Tue Aug 21 12:03:38 2007 +0100
@@ -24,7 +24,9 @@
 						     (%fast-duration row timebase)
 						     (%fast-id row)))))
 	(when (%fast-monodyp row)
-	  (push note monody-notes))
+	  (let ((monody-note (copy-event note)))
+	     (setf (duration monody-note) (%fast-monody-duration row timebase))
+	     (push monody-note monody-notes)))
 	(when (> (timepoint (cut-off note)) last-time)
 	  (setf last-time (timepoint (cut-off note))))
 	(push note notes)
@@ -92,6 +94,8 @@
   (eighth event-row))
 (defun %fast-monodyp (event-row)
   (ninth event-row))
+(defun %fast-monody-duration (event-row timebase)
+  (/ (tenth event-row) timebase))
 
 (defun %fast-tempo (tp-row)
   (eighth tp-row))
@@ -147,7 +151,7 @@
 		   :velocity velocity
 		   :patch patch
 		   :id id)))
-(defmethod copy-event ((event geerdes-percussive-event)) 
+(defmethod copy-event ((event geerdes-percussive-event))
   (with-slots ((channel amuse-midi::channel)
 	       (track amuse-midi::track)
 	       (time amuse::time)
@@ -157,7 +161,7 @@
 	       (sound amuse-midi::sound) id)
       event
     (make-instance 'geerdes-percussive-event
-		   :channel channel 
+		   :channel channel
 		   :track track
 		   :time time
 		   :interval interval
--- a/implementations/geerdes/methods.lisp	Mon Aug 20 15:44:32 2007 +0100
+++ b/implementations/geerdes/methods.lisp	Tue Aug 21 12:03:38 2007 +0100
@@ -84,7 +84,7 @@
 (defun get-db-events (file-id)
   (clsql:query
    (concatenate 'string "
-    SELECT track, channel, start, duration, patch, pitch, velocity, id, event_id
+    SELECT track, channel, start, duration, patch, pitch, velocity, id, event_id, mel_duration
     FROM midi_event LEFT JOIN derived_midi_monody ON (id=event_id)
     WHERE file_id=" (princ-to-string file-id)
     " ORDER BY start")))