]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-music-types.scm
*** empty log message ***
[lilypond.git] / scm / define-music-types.scm
index d0acbc44255a22b1b490c70b4f3b53a9d74e6b6c..73ab524a2f762153e92aa0e922212be82e13d0b3 100644 (file)
@@ -2,17 +2,16 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c)  1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 1998--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 ;;;;                Jan Nieuwenhuizen <janneke@gnu.org>
 
-
 ;; TODO: should link back into user manual.
 
 (define-public music-descriptions
   `(
     (AbsoluteDynamicEvent
      . (
-   (description . "Creates a dynamic mark.
+       (description . "Creates a dynamic mark.
 
 Syntax: @var{note}@code{\\x},
 where x is one of \\ppp, \\pp, \\p, \\mp, \\mf, \\f, \\ff, \\fff.")
@@ -57,7 +56,7 @@ Syntax:
     ;; separate non articulation scripts  
     (ArticulationEvent
      . (
-   (description .  "Adds an articulation marking to a note.  
+       (description .  "Adds an articulation marking to a note.  
 
 Syntax:
 @var{note}@code{X}@code{Y}, where X is a direction (up @code{^}, down
@@ -93,7 +92,7 @@ is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto},
        ))
     (BeamEvent
      . (
-   (description .  "Starts or stops a beam.  
+       (description .  "Starts or stops a beam.  
 
 Syntax for manual control:
 c8-[ c c-] c8")
@@ -102,7 +101,7 @@ c8-[ c c-] c8")
        ))
     (BreakEvent
      . (
-   (description .  "Create a line break, Syntax: \\break or page break, Syntax: \\pagebreak.")
+       (description .  "Create a line break, Syntax: \\break or page break, Syntax: \\pagebreak.")
 
        (internal-class-name . "Event")
        (types . (general-music break-event event))
@@ -139,7 +138,7 @@ Syntax @code{\\translator Staff = @var{new-id}}.")
        (description .  "A note that is part of a cluster.")
        (internal-class-name . "Event")
 
-       ; not a note-event, to ensure that Note_engraver doesn't eat it. 
+                                       ; not a note-event, to ensure that Note_engraver doesn't eat it. 
        (types . (general-music cluster-note-event melodic-event rhythmic-event event))
        ))
     
@@ -169,7 +168,7 @@ Syntax: @var{note}\\cr
        (internal-class-name . "Event")
        (types . (general-music dynamic-event decrescendo-event event))
        ))
+    
     (ExtenderEvent
      . (
        (description .  "Extend lyrics.")
@@ -199,8 +198,9 @@ Syntax: @var{note}\\cr
     (GraceMusic
      . (
        (description .  "Interpret the argument as grace notes. ")
-
-       (internal-class-name . "Grace_music")
+       (internal-class-name . "Music_wrapper")
+       (start-callback . ,Grace_music::start_callback)
+       (length . ,(ly:make-moment 0 1))
        (iterator-ctor . ,Grace_iterator::constructor)
        (types . (grace-music music-wrapper-music general-music))
        ))
@@ -230,7 +230,7 @@ Syntax: @var{note}\\cr
 
 Syntax: @code{\\key } @var{name} @var{scale}.")
 
-       (internal-class-name . "Key_change_ev")
+       (internal-class-name . "Event")
        (types . (general-music key-change-event event))
        ))
     
@@ -247,11 +247,12 @@ Syntax: @code{\\key } @var{name} @var{scale}.")
      . (
        (description .  "Align lyrics to the start of notes.
 
+Syntax @var{\\oldaddlyrics }@var{music} @var{lyrics}.")
 
-Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
-
-       (internal-class-name . "Lyric_combine_music")
+       (internal-class-name . "Music")
        (types . (general-music lyric-combine-music))
+       (length-callback . ,Lyric_combine_music::length_callback)
+       (start-callback . ,Music_sequence::first_start_callback)
        (iterator-ctor . ,Lyric_combine_music_iterator::constructor)
        ))
     
@@ -259,8 +260,7 @@ Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
      . (
        (description .  "Align lyrics to the start of notes.
 
-
-Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
+Syntax @var{\\lyricsto }@var{voicename} @var{lyrics}.")
        (internal-class-name . "Music")
        (length . ,(ly:make-moment 0 1))
        (types . (general-music lyric-combine-music))
@@ -352,7 +352,9 @@ SYNTAX
      . (
        (description .  "Combine two parts on a staff, either merged or
 as separate voices.")
-       (internal-class-name . "Simultaneous_music")
+       (internal-class-name . "Music")
+       (length-callback . ,Music_sequence::maximum_length_callback)
+       (start-callback . ,Music_sequence::minimum_start_callback)
        (types . (general-music part-combine-music))
        (iterator-ctor . ,Part_combine_iterator::constructor)
        ))
@@ -369,15 +371,12 @@ Syntax NOTE \\(  and \\) NOTE")
      . (
        (description .  "Set a context property.
 
-
-
 Syntax: @code{\\property @var{context}.@var{prop} = @var{scheme-val}}.")
        (internal-class-name . "Music")
        (types . (layout-instruction general-music))
        (iterator-ctor . ,Property_iterator::constructor)
-       )
-     )
-    
+       ))
+
     (PropertyUnset
      . (
        (description .  "Remove the definition of a context @code{\\property}.")
@@ -385,8 +384,7 @@ Syntax: @code{\\property @var{context}.@var{prop} = @var{scheme-val}}.")
        (internal-class-name . "Music")
        (types . (layout-instruction general-music))
        (iterator-ctor . ,Property_unset_iterator::constructor)
-       )
-     )
+       ))
     
     (PesOrFlexaEvent
      . (
@@ -401,14 +399,15 @@ goes down).")
     (QuoteMusic
      . (
        (description . "Quote preprocessed snippets of music. ")
-       (internal-class-name . "Music_wrapper") ;;  so we get Event::get_length ().
+       (internal-class-name . "Music_wrapper")
        (iterator-ctor . ,Quote_iterator::constructor)
        (types . (general-music))
        ))
     
     (RelativeOctaveCheck
      . ((description . "Check if a pitch is in the correct octave.")
-       (internal-class-name . "Relative_octave_check")
+       (internal-class-name . "Music")
+       (to-relative-callback . ,Relative_octave_check::relative_callback)
        (types . (general-music relative-octave-check))
        ))
     
@@ -453,7 +452,9 @@ previously added property from a graphical object definition
 
 Syntax \\sequential @{..@} or simply @{..@} .")
 
-       (internal-class-name . "Sequential_music")
+       (internal-class-name . "Music")
+       (length-callback . ,Music_sequence::cumulative_length_callback)
+       (start-callback . ,Music_sequence::first_start_callback)
        (iterator-ctor . ,Sequential_music_iterator::constructor)
        (types . (general-music sequential-music))
        ))
@@ -464,7 +465,9 @@ Syntax \\sequential @{..@} or simply @{..@} .")
 to group start-mmrest, skip, stop-mmrest sequence. 
 
 Syntax @code{R2.*5} for 5 measures in 3/4 time.")
-       (internal-class-name . "Sequential_music")
+       (internal-class-name . "Music")
+       (length-callback . ,Music_sequence::cumulative_length_callback)
+       (start-callback . ,Music_sequence::first_start_callback)
        (iterator-ctor . ,Sequential_music_iterator::constructor)
        (types . (general-music sequential-music))
        ))
@@ -497,8 +500,11 @@ SYNTAX
 
 @code{ \\simultaneous @{ .. @}} or < .. >.")
 
-       (internal-class-name . "Simultaneous_music")
+       (internal-class-name . "Music")
        (iterator-ctor . ,Simultaneous_music_iterator::constructor)
+       (start-callback . ,Music_sequence::minimum_start_callback)
+       (length-callback . ,Music_sequence::maximum_length_callback)
+       (to-relative-callback . ,Music_sequence::simultaneous_relative_callback)
        
        (types . (general-music simultaneous-music))
        ))
@@ -554,7 +560,7 @@ Syntax @code{\\outputproperty @var{predicate} @var{prop}
 Syntax @code{\\times @var{fraction} @var{music}}, e.g.
 @code{\\times 2/3 @{ ... @}} for triplets.
  ")
-       (internal-class-name . "Time_scaled_music")
+       (internal-class-name . "Music_wrapper")
        (iterator-ctor . ,Time_scaled_music_iterator::constructor)
        (types . (time-scaled-music music-wrapper-music general-music))
        ))
@@ -562,15 +568,17 @@ Syntax @code{\\times @var{fraction} @var{music}}, e.g.
     (TransposedMusic
      . (
        (description .  "Music that has been transposed.")
-       (internal-class-name . "Transposed_music")
+       (internal-class-name . "Music_wrapper")
+       (to-relative-callback . ,Relative_octave_music::no_relative_callback)
        (types . (music-wrapper-music general-music transposed-music))
        ))
 
     (UntransposableMusic
      . (
        (description .  "Music that can not be transposed.")
-
-       (internal-class-name . "Untransposable_music")
+       (to-relative-callback . ,Relative_octave_music::no_relative_callback)
+       (untransposable . #t)
+       (internal-class-name . "Music_wrapper")
        (types . (music-wrapper-music general-music untransposable-music)) 
        ))
 
@@ -578,26 +586,28 @@ Syntax @code{\\times @var{fraction} @var{music}}, e.g.
      . (
        (description .  "Music that can not be converted from relative to absolute notation.
 For example, transposed music.")
-       (internal-class-name . "Un_relativable_music")
+       (to-relative-callback . ,Relative_octave_music::no_relative_callback)
+       (internal-class-name . "Music_wrapper")
        (types . (music-wrapper-music general-music unrelativable-music))
        ))
 
     (RelativeOctaveMusic
      . (
        (description .  "Music that was entered in relative octave notation.")
-
-       (internal-class-name . "Relative_octave_music")
+       (to-relative-callback . ,Relative_octave_music::relative_callback)
+       (internal-class-name . "Music_wrapper")
        (types . (music-wrapper-music general-music relative-octave-music))
        ))
     
     (EventChord
      . (
        (description .  "Internally used to group a set of events.")
-       (internal-class-name . "Event_chord")
+       (internal-class-name . "Music")
        (iterator-ctor . ,Event_chord_iterator::constructor)
+       (length-callback . ,Music_sequence::maximum_length_callback)
+       (to-relative-callback . ,Music_sequence::event_chord_relative_callback)
        (types . (general-music event-chord simultaneous-music))
-       )
-     )
+       ))
     
     (ScriptEvent
      . (
@@ -616,11 +626,11 @@ does not create staffs or voices implicitly.
 
 Syntax: @code{\\skip }@var{duration}.")
        (internal-class-name . "Music")
-       (length . ,ly:music-duration-length)
+       (length-callback . ,ly:music-duration-length)
        (iterator-ctor . ,Simple_music_iterator::constructor)
        (types . (general-music event rhythmic-event skip-event))
        ))
-     
+    
     (SkipEvent
      . (
        (description .  "Filler that takes up duration, but does not print anything.
@@ -710,10 +720,10 @@ Syntax: @code{\\\\}")
     (VoltaRepeatedMusic
      . (
        (iterator-ctor . ,Volta_repeat_iterator::constructor)
-       (internal-class-name . "Repeated_music")
+       (internal-class-name . "Music")
        (description . "")
-       (start-moment-function .  ,Repeated_music::first_start)
-       (length . ,Repeated_music::volta_music_length)
+       (start-callback .  ,Repeated_music::first_start)
+       (length-callback . ,Repeated_music::volta_music_length)
        (types . (general-music repeated-music volta-repeated-music))
        ))
     
@@ -721,18 +731,18 @@ Syntax: @code{\\\\}")
      . (
        (iterator-ctor . ,Unfolded_repeat_iterator::constructor)
        (description .  "")
-       (start-moment-function .  ,Repeated_music::first_start)
-       (internal-class-name . "Repeated_music")
+       (start-callback .  ,Repeated_music::first_start)
+       (internal-class-name . "Music")
        (types . (general-music repeated-music unfolded-repeated-music))
-       (length . ,Repeated_music::unfolded_music_length)
+       (length-callback . ,Repeated_music::unfolded_music_length)
        ))
     (PercentRepeatedMusic
      . (
-       (internal-class-name . "Repeated_music")
+       (internal-class-name . "Music")
        (description .  "Repeats encoded by percents.")
        (iterator-ctor . ,Percent_repeat_iterator::constructor)
-       (start-moment-function .  ,Repeated_music::first_start)
-       (length . ,Repeated_music::unfolded_music_length)
+       (start-callback .  ,Repeated_music::first_start)
+       (length-callback . ,Repeated_music::unfolded_music_length)
        (types . (general-music repeated-music percent-repeated-music))
        ))
     
@@ -740,22 +750,22 @@ Syntax: @code{\\\\}")
      . (
        (iterator-ctor . ,Chord_tremolo_iterator::constructor)
        (description .  "Repeated notes denoted by tremolo beams.")
-       (internal-class-name . "Repeated_music")
-       (start-moment-function .  ,Repeated_music::first_start)
+       (internal-class-name . "Music")
+       (start-callback .  ,Repeated_music::first_start)
 
        ;; the length of the repeat is handled by shifting the note logs
-       (length . ,Repeated_music::folded_music_length)
+       (length-callback . ,Repeated_music::folded_music_length)
        (types . (general-music repeated-music tremolo-repeated-music))
        
        ))
     
     (FoldedRepeatedMusic
      . (
-       (internal-class-name . "Repeated_music")
+       (internal-class-name . "Music")
        (description .  "Repeats with alternatives placed in parallel. ")
        (iterator-ctor  . ,Folded_repeat_iterator::constructor)
-       (start-moment-function .  ,Repeated_music::minimum_start)
-       (length . ,Repeated_music::folded_music_length)
+       (start-callback .  ,Repeated_music::minimum_start)
+       (length-callback . ,Repeated_music::folded_music_length)
        (types . (general-music repeated-music folded-repeated-music))
        ))
     ))
@@ -765,7 +775,6 @@ Syntax: @code{\\\\}")
 
 (define music-name-to-property-table (make-vector 59 '()))
 
-
 ;; init hash table,
 ;; transport description to an object property.
 (set!
@@ -774,13 +783,11 @@ Syntax: @code{\\\\}")
        (set-object-property! (car x)
                              'music-description
                              (cdr (assq 'description (cdr x))))
-       (let
-           ((l (cdr x)))
-         (set! l (assoc-set! l 'name (car x)))
-         (set! l (assq-remove!  l 'description))
-         (hashq-set! music-name-to-property-table (car x) l)
-         (cons (car x) l)
-         ))
+       (let ((lst (cdr x)))
+         (set! lst (assoc-set! lst 'name (car x)))
+         (set! lst (assq-remove! lst 'description))
+         (hashq-set! music-name-to-property-table (car x) lst)
+         (cons (car x) lst)))
       music-descriptions))
 
 (define-public (make-music name . music-properties)
@@ -806,7 +813,6 @@ and values. E.g:
       (set-props music-properties)
       m)))
 
-
 (define-public (make-repeated-music name)
   (let* ((handle (assoc name '(("volta" . VoltaRepeatedMusic)
                               ("unfold" . UnfoldedRepeatedMusic)