[gsharp-cvs] CVS gsharp

crhodes crhodes at common-lisp.net
Tue Sep 18 21:19:04 UTC 2007


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

Modified Files:
	buffer.lisp drawing.lisp gui.lisp score-pane.lisp sdl.lisp 
Log Message:
Support long ("lunga") notes and rests.

It's a bit weird, because the lunga has the same notehead as a breve, 
but also has a stem; so having a NOTEHEAD of :long is a bit of a 
misnomer.  Hey ho.


--- /project/gsharp/cvsroot/gsharp/buffer.lisp	2007/09/14 15:57:21	1.52
+++ /project/gsharp/cvsroot/gsharp/buffer.lisp	2007/09/18 21:19:03	1.53
@@ -195,9 +195,9 @@
 ;;; 
 ;;; The staff is a staff object. 
 ;;; 
-;;; Head can be :breve, :whole, :half, :filled, or nil.  A value of
-;;; nil means that the notehead is determined by that of the cluster
-;;; to which the note belongs.
+;;; Head can be :long, :breve, :whole, :half, :filled, or nil.  A
+;;; value of nil means that the notehead is determined by that of the
+;;; cluster to which the note belongs.
 ;;; 
 ;;; Accidentals can be :natural :flat :double-flat :sharp or :double-sharp.
 ;;; The default is :natural.  Whether a note is actually displayed
@@ -217,7 +217,7 @@
    (pitch :initarg :pitch :reader pitch :type (integer 0 127))
    (staff :initarg :staff :reader staff :type staff)
    (head :initform nil :initarg :head :reader head
-         :type (or (member :breve :whole :half :filled) null))
+         :type (or (member :long :breve :whole :half :filled) null))
    (accidentals :initform :natural :initarg :accidentals :reader accidentals
 		;; FIXME: we want :TYPE ACCIDENTAL here but need to
 		;; sort out order of definition for that to be useful.
@@ -231,7 +231,7 @@
 (defun make-note (pitch staff &rest args &key head (accidentals :natural) dots)
   (declare (type (integer 0 127) pitch)
            (type staff staff)
-           (type (or (member :breve :whole :half :filled) null) head)
+           (type (or (member :long :breve :whole :half :filled) null) head)
 	   ;; FIXME: :TYPE ACCIDENTAL
 	   #+nil #+nil
            (type (member :natural :flat :double-flat :sharp :double-sharp)
@@ -418,6 +418,7 @@
 
 (defmethod undotted-duration ((element rhythmic-element))
   (ecase (notehead element)
+    (:long 4)
     (:breve 2)
     (:whole 1)
     (:half 1/2)
@@ -540,7 +541,7 @@
 (defun make-cluster (&rest args
                      &key (notehead :filled) (lbeams 0) (rbeams 0) (dots 0)
                      (xoffset 0) notes (stem-direction :auto))
-  (declare (type (member :breve :whole :half :filled) notehead)
+  (declare (type (member :long :breve :whole :half :filled) notehead)
            (type (integer 0 5) lbeams)
            (type (integer 0 5) rbeams)
            (type (integer 0 3) dots)
@@ -627,7 +628,7 @@
                   (dots 0) (xoffset 0))
   (declare (type staff staff)
            (type integer staff-pos)
-           (type (member :breve :whole :half :filled) notehead)
+           (type (member :long :breve :whole :half :filled) notehead)
            (type (integer 0 5) lbeams)
            (type (integer 0 5) rbeams)
            (type (integer 0 3) dots)
@@ -673,7 +674,7 @@
                             &key (notehead :filled) (lbeams 0) (rbeams 0)
                             (dots 0) (xoffset 0))
   (declare (type staff staff)
-           (type (member :breve :whole :half :filled) notehead)
+           (type (member :long :breve :whole :half :filled) notehead)
            (type (integer 0 5) lbeams)
            (type (integer 0 5) rbeams)
            (type (integer 0 3) dots)
--- /project/gsharp/cvsroot/gsharp/drawing.lisp	2007/09/14 15:48:05	1.83
+++ /project/gsharp/cvsroot/gsharp/drawing.lisp	2007/09/18 21:19:03	1.84
@@ -325,7 +325,7 @@
          (elements (elements bar)))
     (and (null (cdr elements))
          (typep element 'rest)
-         (member (notehead element) '(:breve :whole)))))
+         (member (notehead element) '(:long :breve :whole)))))
 
 (defun compute-measure-coordinates (measure x y force)
   (loop with timelines = (timelines measure)
--- /project/gsharp/cvsroot/gsharp/gui.lisp	2007/09/17 20:30:59	1.86
+++ /project/gsharp/cvsroot/gsharp/gui.lisp	2007/09/18 21:19:03	1.87
@@ -754,10 +754,11 @@
   (define-duration-altering-command com-rotate-notehead ()
     (setf (notehead element)
           (ecase (notehead element)
+            (:breve :long)
             (:whole :breve)
             (:half :whole)
             (:filled :half)
-            (:breve :filled)))))
+            (:long :filled)))))
 
 (define-gsharp-command com-rotate-stem-direction ()
   (setf (stem-direction (cur-cluster))
@@ -1302,10 +1303,11 @@
 (define-gsharp-command com-istate-rotate-notehead ()
   (setf (notehead (input-state *application-frame*))
         (ecase (notehead (input-state *application-frame*))
+          (:breve :long)
           (:whole :breve)
           (:half :whole)
           (:filled :half)
-          (:breve :filled))))            
+          (:long :filled))))            
 
 (define-gsharp-command com-istate-rotate-stem-direction ()
   (setf (stem-direction (input-state *application-frame*))
--- /project/gsharp/cvsroot/gsharp/score-pane.lisp	2007/09/14 15:48:05	1.38
+++ /project/gsharp/cvsroot/gsharp/score-pane.lisp	2007/09/18 21:19:03	1.39
@@ -132,7 +132,7 @@
 (defun draw-notehead (stream name x staff-step)
   (sdl::draw-shape stream *font* 
 		   (ecase name
-		     (:breve :breve-notehead)
+		     ((:breve :long) :breve-notehead)
 		     (:whole :whole-notehead)
 		     (:half :half-notehead)
 		     (:filled :filled-notehead))
@@ -175,6 +175,7 @@
 (defun draw-rest (stream duration x staff-step)
   (sdl::draw-shape stream *font*
                    (ecase duration
+                     (4 :long-rest)
                      (2 :breve-rest)
                      (1 :whole-rest)
                      (1/2 :half-rest)
--- /project/gsharp/cvsroot/gsharp/sdl.lisp	2007/09/14 15:48:05	1.36
+++ /project/gsharp/cvsroot/gsharp/sdl.lisp	2007/09/18 21:19:03	1.37
@@ -1352,6 +1352,12 @@
 ;;;
 ;;; Rests
 
+(defmethod compute-design ((font font) (shape (eql :long-rest)))
+  (with-slots ((sld staff-line-distance) (slt staff-line-thickness)
+               notehead-width xoffset yoffset) font
+    (translate (xyscale +unit-square+ (/ notehead-width 2) (* 2 sld))
+               (complex xoffset (+ yoffset (- (* 0.5 slt)))))))
+
 (defmethod compute-design ((font font) (shape (eql :breve-rest)))
   (with-slots ((sld staff-line-distance) (slt staff-line-thickness)
                notehead-width xoffset yoffset) font




More information about the Gsharp-cvs mailing list