Mercurial > hg > amuse
changeset 174:9b152d515275
New partially functional clefs
darcs-hash:20080313112229-40ec0-35f844cc728dd8bc7061c9a876723012f8d83ef6.gz
author | d.lewis <d.lewis@gold.ac.uk> |
---|---|
date | Thu, 13 Mar 2008 11:22:29 +0000 |
parents | 1361b02e7023 |
children | 7e8d95d00267 |
files | base/classes.lisp base/constructors.lisp |
diffstat | 2 files changed, 75 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/base/classes.lisp Thu Mar 13 11:20:51 2008 +0000 +++ b/base/classes.lisp Thu Mar 13 11:22:29 2008 +0000 @@ -12,7 +12,6 @@ (defclass constituent-identifier (identifier) () (:documentation "Base class to allow specifiction of constituents")) - (defclass composition-identifier (constituent-identifier) () (:documentation "Base class to allow-specification of constituents")) @@ -132,7 +131,7 @@ (defclass standard-key-signature (key-signature) ((sharp-count :accessor %basic-key-signature-sharp-count - :initarg :sharp-count)) + :initarg :sharp-count)) (:documentation "Simple class - Only has line-of-fifths distance from c, so custom signatures won't work")) @@ -177,6 +176,7 @@ (defclass standard-constituent (constituent standard-anchored-period) () (:documentation "Base class for constituents using standard time representation")) + (defclass time-ordered-constituent (constituent list-slot-sequence) ;; this won't work if lisp implementation doesn't support extensible ;; sequences. @@ -187,8 +187,11 @@ ;; this won't work if lisp implementation doesn't support extensible ;; sequences. ()) + + (defclass composition (time-ordered-constituent) () (:documentation "Base class for compositions")) + (defclass standard-composition (composition standard-time-ordered-constituent) () (:documentation "Base class for compositions using standard @@ -197,3 +200,32 @@ (:documentation "Class for indicating suitability for analysis requiring a monody")) (defclass standard-monody (monody standard-composition) ()) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Experimental: +;; + +(defclass clef (amuse-object) () + (:documentation "Abstract class for clef implementations")) + +(defclass clef-period (clef anchored-period) () + (:documentation "Abstract class for clef implementations in time")) + +(defclass standard-clef (clef) + ((type :accessor %standard-clef-type + :initarg :type) + (line :accessor %standard-clef-line + :initarg :line) + (octave-shift :accessor %standard-clef-octave-shift + :initarg :octave-shift + :initform nil)) + (:documentation "Class of clef with slots for type (a keyword + from :F, :G and :C, probably), line (counting from the lowest line = + 1) and octave shift (nil or a positive or negative integer + representing transposition up or down")) + +(defclass standard-clef-period (standard-clef clef-period standard-anchored-period) + () + (:documentation "Standard clef on a timeline")) + \ No newline at end of file
--- a/base/constructors.lisp Thu Mar 13 11:20:51 2008 +0000 +++ b/base/constructors.lisp Thu Mar 13 11:22:29 2008 +0000 @@ -109,3 +109,44 @@ :bpm bpm :time onset :interval duration)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Experimental: +;; + +(defun make-standard-clef-period (type line onset duration &key octave-shift) + "Constructor for standard-clef-periods" + (make-instance 'standard-clef-period + :type type + :line line + :octave-shift octave-shift + :time onset + :interval duration)) + +(defun make-standard-treble-clef-period (onset duration) + "Convenience function for making treble clefs" + (make-instance 'standard-clef-period + :type :G + :line 2 + :octave-shift nil + :time onset + :interval duration)) + +(defun make-standard-bass-clef-period (onset duration) + "Convenience function for making bass clefs" + (make-instance 'standard-clef-period + :type :F + :line 4 + :octave-shift nil + :time onset + :interval duration)) + +(defun make-standard-alto-clef-period (onset duration) + "Convenience function for making alto clefs" + (make-instance 'standard-clef-period + :type :C + :line 3 + :octave-shift nil + :time onset + :interval duration)) \ No newline at end of file