[gsharp-cvs] CVS gsharp

rstrandh rstrandh at common-lisp.net
Wed Aug 29 15:42:57 UTC 2007


Update of /project/gsharp/cvsroot/gsharp
In directory clnet:/tmp/cvs-serv26221

Modified Files:
	measure.lisp 
Log Message:
Fixed the first problem reported by Taylor Campbell, namely that the
locations of certain notes compared to the stem are not computed
correctly.

The main problem was that compute-element-parameters was called only
for elements that have been modified.  However, those parameters might
change as a result of beaming with other elements, so we need to call
compute-element-parameters on all elements. 

While searching for the cause of this problem, I also noticed that a
stem direction that was forced to change as a result of beaming with a
subsequent element (such that the stem direction for the entire beam
group was different from the nominal one for the cluster) did not
return to its nominal stem direction when the subsequent element was
deleted.  The reason for this problem was that
compute-final-stem-direction was not called unless any of the elements
of the beam group was marked as modified.  When the subsequent element
was removed, none of the remaining elements was marked that way.  The
fix was to always call compute-final-stem-direction.  

I also discovered another problem from Taylor's example, namely that
sometimes, the stem direction of a beam group in which each cluster
has the same nominal stem direction can be different from the nominal
stem direction of the individual clusters.  The reason for this
problem seems to be that the algorithm for computing the stem
direction of a beam group is just wrong.  I am still working on this
problem.



--- /project/gsharp/cvsroot/gsharp/measure.lisp	2007/08/07 14:00:09	1.36
+++ /project/gsharp/cvsroot/gsharp/measure.lisp	2007/08/29 15:42:57	1.37
@@ -613,21 +613,17 @@
 	  do (compute-staff-group-parameters staff-group (final-stem-direction element)))))
 
 (defun compute-beam-group-parameters (elements)
-  (let ((any-element-modified nil))
-    (loop for element in elements
-	  do (when (modified-p element)
-	       (when (non-empty-cluster-p element)
-		 (compute-top-bot-pos element))
-	       (setf any-element-modified t)))
-    (when any-element-modified
-      (if (null (cdr elements))
-	  (when (non-empty-cluster-p (car elements))
-	    (compute-final-stem-direction (car elements)))
-	  (compute-final-stem-directions elements)))
-    (loop for element in elements
-	  do (when (modified-p element)
-	       (compute-element-parameters element)
-	       (setf (modified-p element) nil)))))
+  (loop for element in elements
+        do (when (modified-p element)
+             (when (non-empty-cluster-p element)
+               (compute-top-bot-pos element))))
+  (if (null (cdr elements))
+      (when (non-empty-cluster-p (car elements))
+        (compute-final-stem-direction (car elements)))
+      (compute-final-stem-directions elements))
+  (loop for element in elements
+        do (compute-element-parameters element)
+        do (setf (modified-p element) nil)))
 
 ;;; Given a list of the elements of a bar, return a list of beam
 ;;; groups.  A beam group is defined to be either a singleton list or




More information about the Gsharp-cvs mailing list