[gsharp-cvs] CVS update: gsharp/measure.lisp

Robert Strandh rstrandh at common-lisp.net
Tue Nov 29 18:05:05 UTC 2005


Update of /project/gsharp/cvsroot/gsharp
In directory common-lisp.net:/tmp/cvs-serv28565

Modified Files:
	measure.lisp 
Log Message:
Fixed a bug in the code for creating the timelines.  The calculation
of the start times of the timelines was wrong.

Date: Tue Nov 29 19:05:04 2005
Author: rstrandh

Index: gsharp/measure.lisp
diff -u gsharp/measure.lisp:1.17 gsharp/measure.lisp:1.18
--- gsharp/measure.lisp:1.17	Tue Nov 29 05:22:20 2005
+++ gsharp/measure.lisp	Tue Nov 29 19:05:03 2005
@@ -653,10 +653,10 @@
 
 (defun compute-timelines (measure)
   (let ((timelines (timelines measure))
-	(start-times (measure-start-times measure)))
+	(durations (abs-rel (measure-start-times measure))))
     ;; create a timeline for each start time of the measure
-    (loop for start-time in start-times
-	  for duration in (abs-rel start-times)
+    (loop for duration in durations
+	  for start-time = 0 then (+ start-time duration)
 	  for i from 0
 	  do (let ((timeline (make-instance 'timeline
 			       :start-time start-time
@@ -665,15 +665,15 @@
     ;; link each timeline to its elements and each element of a
     ;; timeline to the timeline
     (loop for bar in (measure-bars measure)
-	  do (loop for element in (elements bar)
+	  do (loop with timeline-index = 0
+		   for element in (elements bar)
 		   for start-time = 0 then (+ start-time (duration element))
-		   for timeline-index from 0
 		   do (loop while (< (start-time (flexichain:element* timelines timeline-index))
 				     start-time)
-		   do (incf timeline-index))
+			    do (incf timeline-index))
 		   do (let ((timeline (flexichain:element* timelines timeline-index)))
-		   (push element (elements timeline))
-		   (setf (timeline element) timeline))))))
+			(push element (elements timeline))
+			(setf (timeline element) timeline))))))
 
 ;;; Compute all the measures of a segment by stepping through all the
 ;;; bars in parallel as long as there is at least one simultaneous bar.




More information about the Gsharp-cvs mailing list