[gsharp-cvs] CVS update: gsharp/buffer.lisp gsharp/measure.lisp gsharp/packages.lisp gsharp/play.lisp
Robert Strandh
rstrandh at common-lisp.net
Mon Oct 31 02:16:29 UTC 2005
Update of /project/gsharp/cvsroot/gsharp
In directory common-lisp.net:/tmp/cvs-serv30200
Modified Files:
buffer.lisp measure.lisp packages.lisp play.lisp
Log Message:
Got rid of ELEMENT-DURATION in favor of just DURATION by converting
a :before method to an :around method.
Date: Mon Oct 31 03:16:27 2005
Author: rstrandh
Index: gsharp/buffer.lisp
diff -u gsharp/buffer.lisp:1.10 gsharp/buffer.lisp:1.11
--- gsharp/buffer.lisp:1.10 Mon Oct 31 02:41:13 2005
+++ gsharp/buffer.lisp Mon Oct 31 03:16:27 2005
@@ -244,7 +244,7 @@
(:filled (/ (expt 2 (+ 2 (max (rbeams element)
(lbeams element))))))))
-(defmethod element-duration ((element element))
+(defmethod duration ((element element))
(let ((duration (undotted-duration element)))
(do ((dot-duration (/ duration 2) (/ dot-duration 2))
(nb-dots (dots element) (1- nb-dots)))
Index: gsharp/measure.lisp
diff -u gsharp/measure.lisp:1.3 gsharp/measure.lisp:1.4
--- gsharp/measure.lisp:1.3 Fri Jul 23 18:51:16 2004
+++ gsharp/measure.lisp Mon Oct 31 03:16:27 2005
@@ -21,16 +21,17 @@
;;; a `duration' slot that contains the duration of the element.
;;; It also makes sure that whenever the duration of an element
;;; is being asked for, the new value is computed should any
-;;; modification to the element have taken placed in the meantime.
+;;; modification to the element have taken place in the meantime.
(defrclass relement element
- ((duration :initform nil :reader duration)))
+ ((duration :initform nil)))
-(defmethod duration :before ((element relement))
+(defmethod duration :around ((element relement))
(with-slots (duration) element
(when (or (modified-p element) (null duration))
- (setf duration (element-duration element))
- (setf (modified-p element) nil))))
+ (setf duration (call-next-method))
+ (setf (modified-p element) nil))
+ duration))
(defmethod mark-modified ((element relement))
(setf (modified-p element) t)
Index: gsharp/packages.lisp
diff -u gsharp/packages.lisp:1.13 gsharp/packages.lisp:1.14
--- gsharp/packages.lisp:1.13 Mon Oct 31 02:49:47 2005
+++ gsharp/packages.lisp Mon Oct 31 03:16:27 2005
@@ -66,7 +66,7 @@
#:rename-staff
#:add-staff-to-layer
#:remove-staff-from-layer
- #:stem-direction #:stem-length #:undotted-duration #:element-duration
+ #:stem-direction #:stem-length #:undotted-duration #:duration
#:clef #:keysig #:staff-pos #:xoffset #:read-everything #:save-buffer-to-stream
#:line-width #:min-width #:spacing-style #:right-edge #:left-offset
#:left-margin #:text #:append-char #:erase-char
@@ -91,7 +91,7 @@
(:use :common-lisp :gsharp-numbering :gsharp-buffer :gsharp-utilities :obseq)
(:shadowing-import-from :gsharp-numbering #:number)
(:shadowing-import-from :gsharp-buffer #:rest)
- (:export #:mark-modified #:modified-p #:duration #:measure
+ (:export #:mark-modified #:modified-p #:measure
#:measure-min-dist #:measure-coeff #:measure-start-times
#:measure-bar-pos #:measure-seg-pos #:measure-bars #:measures
#:nb-measures #:measureno
Index: gsharp/play.lisp
diff -u gsharp/play.lisp:1.1 gsharp/play.lisp:1.2
--- gsharp/play.lisp:1.1 Mon Oct 31 02:41:13 2005
+++ gsharp/play.lisp Mon Oct 31 03:16:27 2005
@@ -10,7 +10,7 @@
(let ((durations (mapcar (lambda (slice)
(mapcar (lambda (bar)
(reduce #'+ (elements bar)
- :key #'element-duration))
+ :key #'duration))
(bars slice)))
slices)))
(loop while durations
@@ -27,7 +27,7 @@
(notes element))
(mapcar (lambda (note)
(make-instance 'note-off-message
- :time (+ time (* 128 (element-duration element)))
+ :time (+ time (* 128 (duration element)))
:status (+ #x80 channel)
:key (midi-pitch note) :velocity 100))
(notes element)))))
@@ -35,7 +35,7 @@
(defun events-from-bar (bar time channel)
(mapcan (lambda (element)
(prog1 (events-from-element element time channel)
- (incf time (* 128 (element-duration element)))))
+ (incf time (* 128 (duration element)))))
(elements bar)))
(defun track-from-slice (slice channel durations)
More information about the Gsharp-cvs
mailing list