[gsharp-devel] Re: [gsharp-cvs] CVS update: gsharp/drawing.lisp gsharp/measure.lisp gsharp/packages.lisp

Robert Strandh strandh at labri.fr
Wed Nov 30 03:15:20 UTC 2005


Hello,

Christophe Rhodes writes:
 > Key signature protocol:
 > 
 >   Protocol class key-signature
 > 
 >     The base class for elements implementing the key signature
 >     protocol.
 > 
 >   Accessor key-signature-data (key-signature key-signature)
 > 
 >     Returns a seven-element simple-vector containing keywords
 >     :DOUBLE-SHARP, :SHARP, :NATURAL, :FLAT or :DOUBLE-FLAT indicating
 >     the musical key signature indicated by the key-signature.  The
 >     effect of modifying the vector returned by this accessor is
 >     undefined.
 > 
 >     [ Note: in Gsharp we currently modify the underlying data
 >       structure, but it seems elegant instead to keep it unmodifiable,
 >       and place an :after method on (setf key-signature-data) to
 >       invalidate element caches of e.g. accidentals; we can't do this
 >       if we're allowed to do (setf aref) on (key-signature-data
 >       key-signature), which is why I've forbidden it. ]
 > 
 > Now, the proposed :after method on (setf key-signature-data) here
 > would ideally use more support for walking staffwise elements than is
 > currently implemented, though the pessimistic implementation would
 > simply use the existing loop over layers and
 > invalidate-slice-using-staff.

OK, looks good.  I also suggest generic functions MORE-SHARPS and
MORE-FLATS on key signatures that return a new key signature with more
sharps and more flat, as defined by common-practice music notation. 

 > In addition to that support, we need something like this:
 > 
 > Staff scope protocol:
 > 
 >   Protocol class staff-scope-mixin 
 > 
 >     A mixin for elements with staff scope.  Not intended to be directly
 >     instantiated.
 > 
 >   Generic Function staff-scope-element staff position specifier
 > 
 >     Returns the staff-scope-element of type specifier which applies to
 >     the position denoted by position.
 > 
 >   Method staff-scope-element (staff staff) (cursor gsharp-cursor) specifier
 >   Method staff-scope-element (staff staff) (element element) specifier
 > 
 >     The position denoted by a gsharp-cursor is the same as the
 >     position denoted by the element which would be inserted at that
 >     cursor position.  Note that some elements, such as complicated
 >     clusters, do not have an associated staff; however, they denote a
 >     position on that staff by virtue of having notes which are
 >     associated with that staff.  It is an error if specifier is not
 >     subtypep staff-scope-mixin.
 > 
 > This staff scope protocol would be used for elements which have
 > staffwise effect, such as key-signatures, but also clefs, time
 > signatures, instrumentation markings, piano pedal markings...

It took me a few minutes to understand this, but now I do and it seems
OK to me. 

 > We need to know the applicable element at a cursor position, as the
 > applicable element can influence what we insert (e.g. #\c will insert
 > different notes depending on the prevailing key signature); we need to
 > know the applicable element at an element in order to compute how it
 > looks (e.g. the clef, to know which staff line a note belongs on, or a
 > key signature again to know whether a note needs an accidental).

Yep.

-- 
Robert Strandh

---------------------------------------------------------------------
Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.
---------------------------------------------------------------------



More information about the gsharp-devel mailing list