]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-music-types.scm
*** empty log message ***
[lilypond.git] / scm / define-music-types.scm
index 2e3130b45f0e9081c302390889eadb3f5688470e..73ab524a2f762153e92aa0e922212be82e13d0b3 100644 (file)
@@ -2,14 +2,18 @@
 ;;;;
 ;;;;  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.  Syntax: @var{note}@code{\\x},
+       (description . "Creates a dynamic mark.
+
+Syntax: @var{note}@code{\\x},
 where x is one of \\ppp, \\pp, \\p, \\mp, \\mf, \\f, \\ff, \\fff.")
        (internal-class-name . "Event")
        (types . (general-music event dynamic-event absolute-dynamic-event))
@@ -26,9 +30,9 @@ where x is one of \\ppp, \\pp, \\p, \\mp, \\mf, \\f, \\ff, \\fff.")
        (description . "
 Call the argument with all current grobs during interpreting phase.
 
-SYNTAX
+Syntax
 
-\applyoutput FUNC
+\\applyoutput FUNC
 
 arguments to func are 1. the grob, 2. the originating context,
 3. context where FUNC is called.
@@ -40,7 +44,9 @@ arguments to func are 1. the grob, 2. the originating context,
        ))
     (ArpeggioEvent 
      . (
-       (description .  "Make an arpeggio on this note. Syntax:
+       (description .  "Make an arpeggio on this note.
+
+Syntax:
 @var{note}-@code{\\arpeggio}")
        (internal-class-name .  "Event")
        (types . (general-music arpeggio-event event))
@@ -50,7 +56,9 @@ arguments to func are 1. the grob, 2. the originating context,
     ;; separate non articulation scripts  
     (ArticulationEvent
      . (
-   (description .  "Adds an articulation marking to a note.  Syntax:
+       (description .  "Adds an articulation marking to a note.  
+
+Syntax:
 @var{note}@code{X}@code{Y}, where X is a direction (up @code{^}, down
 @code{_}, or LilyPond's choice (no direction specified)), and where Y
 is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto},
@@ -84,21 +92,25 @@ is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto},
        ))
     (BeamEvent
      . (
-   (description .  "Starts or stops a beam.  Syntax for manual control:
+       (description .  "Starts or stops a beam.  
+
+Syntax for manual control:
 c8-[ c c-] c8")
        (internal-class-name . "Event")
        (types . (general-music event beam-event span-event))
        ))
     (BreakEvent
      . (
-   (description .  "Creates a line break.  Syntax: \\break.")
+       (description .  "Create a line break, Syntax: \\break or page break, Syntax: \\pagebreak.")
 
        (internal-class-name . "Event")
        (types . (general-music break-event event))
        ))
     (BreathingSignEvent
      . (
-       (description .  "Creates a `breath mark' or `comma'.  Syntax:
+       (description .  "Creates a `breath mark' or `comma'.  
+
+Syntax:
 @var{note}\\breathe.")
 
        (internal-class-name . "Event")
@@ -111,20 +123,22 @@ c8-[ c c-] c8")
        (internal-class-name . "Event")
        (types . (general-music event busy-playing-event))
        ))
-    (StartPlayingEvent
+    (ContextChange
      . (
-       (description .  "Used internally to signal beginning of notes.")
+       (description .  "Change staffs in Piano staff. 
 
-       (internal-class-name . "Event")
-       (types . (general-music event start-playing-event))
+Syntax @code{\\translator Staff = @var{new-id}}.")
+       (internal-class-name . "Music")
+       (iterator-ctor . , Change_iterator::constructor)
+       (types . (general-music translator-change-instruction))
        ))
-    
+
     (ClusterNoteEvent
      . (
        (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))
        ))
     
@@ -138,7 +152,9 @@ c8-[ c c-] c8")
     
     (CrescendoEvent
      . (
-       (description .  "Begins or ends a crescendo.  Syntax: @var{note}\\cr
+       (description .  "Begins or ends a crescendo.  
+
+Syntax: @var{note}\\cr
 ... @var{note}\\rc (you can also use \\<, \\!, \\cresc, and
 \\endcresc.  See the user manual for details.).")
 
@@ -152,7 +168,7 @@ c8-[ c c-] c8")
        (internal-class-name . "Event")
        (types . (general-music dynamic-event decrescendo-event event))
        ))
+    
     (ExtenderEvent
      . (
        (description .  "Extend lyrics.")
@@ -182,8 +198,9 @@ c8-[ c c-] c8")
     (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))
        ))
@@ -209,9 +226,11 @@ c8-[ c c-] c8")
     
     (KeyChangeEvent
      . (
-       (description .  "Change the key signature. Syntax: @code{\\key } @var{name} @var{scale}.")
+       (description .  "Change the key signature. 
+
+Syntax: @code{\\key } @var{name} @var{scale}.")
 
-       (internal-class-name . "Key_change_ev")
+       (internal-class-name . "Event")
        (types . (general-music key-change-event event))
        ))
     
@@ -227,17 +246,21 @@ c8-[ c c-] c8")
     (LyricCombineMusic
      . (
        (description .  "Align lyrics to the start of notes.
-Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
 
-       (internal-class-name . "Lyric_combine_music")
+Syntax @var{\\oldaddlyrics }@var{music} @var{lyrics}.")
+
+       (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)
        ))
     
     (NewLyricCombineMusic
      . (
        (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))
@@ -254,7 +277,9 @@ Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
        ))
     (MarkEvent
      . (
-       (description .  "Insert a rehearsal mark. Syntax: @code{\\mark} @var{marker},
+       (description .  "Insert a rehearsal mark. 
+
+Syntax: @code{\\mark} @var{marker},
 e.g. @code{\\mark \"A\"}.")
 
        (internal-class-name . "Event")
@@ -270,14 +295,16 @@ e.g. @code{\\mark \"A\"}.")
      . (
        (description .  "Start or stop a melisma.
 
-Syntax:@code{c4\\melisma d\\melismaEnd}.")
+Syntax: @code{c4\\melisma d\\melismaEnd}.")
        (internal-class-name . "Event")
        (types . (general-music melisma-span-event event))
        ))
     
     (MultiMeasureRestEvent
      . (
-       (description . "Rests that may be compressed into Multi rests. Syntax
+       (description . "Rests that may be compressed into Multi rests. 
+
+Syntax
 @code{R2.*4} for 4 measures in 3/4 time. Note the capital R.")
        (internal-class-name . "Event")
        (types . (general-music event rhythmic-event multi-measure-rest-event))
@@ -285,7 +312,9 @@ Syntax:@code{c4\\melisma d\\melismaEnd}.")
     
     (MultiMeasureTextEvent
      . (
-       (description . "Texts on mm rests. Syntax
+       (description . "Texts on mm rests. 
+
+Syntax
 @code{R-\\markup @{ \\roman \"bla\" @}}. Note the explicit font switch.")
        (internal-class-name . "Event")
        (types . (general-music event multi-measure-text-event))
@@ -315,7 +344,6 @@ SYNTAX
 @code{\\propery Foo.Bar \\override} @var{SYMBOL} = @var{VALUE}
 
 ")
-
        (internal-class-name . "Music")
        (types . (general-music layout-instruction))
        (iterator-ctor . ,      Push_property_iterator::constructor)
@@ -324,14 +352,17 @@ 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)
        ))
     (PhrasingSlurEvent
      . (
-       (description . "Start or end phrasing slur. Syntax NOTE \\(  and \\) NOTE")
+       (description . "Start or end phrasing slur. 
+
+Syntax NOTE \\(  and \\) NOTE")
        (internal-class-name . "Event")
        (types . (general-music span-event phrasing-slur-event))
        ))
@@ -344,9 +375,8 @@ 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}.")
@@ -354,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
      . (
@@ -370,21 +399,21 @@ goes down).")
     (QuoteMusic
      . (
        (description . "Quote preprocessed snippets of music. ")
-       (internal-class-name . "Event") ;;  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))
        ))
     
     (RepeatedMusic
      . (
        (description .  "Repeat music in different ways")
-
        (type .  repeated-music)
        (types . (general-music repeated-music))
        ))
@@ -399,16 +428,33 @@ goes down).")
     
     (RestEvent
      . (
-       (description .  "A Rest. Syntax @code{r4} for a quarter rest. ")
+       (description .  "A Rest. 
+
+Syntax @code{r4} for a quarter rest. ")
 
        (internal-class-name . "Event")
        (types . (general-music event rhythmic-event rest-event))
        )) 
+    (RevertProperty
+     . (
+       (description .  "The opposite of @ref{OverrideProperty}: remove a
+previously added property from a graphical object definition
+ ")
+
+       (internal-class-name . "Music")
+       (types . (general-music layout-instruction))
+       (iterator-ctor . ,      Pop_property_iterator::constructor)
+       ))
+
     (SequentialMusic
      . (
-       (description .  "Music expressions concatenated. Syntax \\sequential @{..@} or simply @{..@} .")
+       (description .  "Music expressions concatenated. 
 
-       (internal-class-name . "Sequential_music")
+Syntax \\sequential @{..@} or simply @{..@} .")
+
+       (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))
        ))
@@ -416,8 +462,12 @@ goes down).")
     (MultiMeasureRestMusicGroup
      . (
        (description .  "Like sequential-music, but specifically intended
-to group start-mmrest, skip, stop-mmrest sequence. Syntax @code{R2.*5} for 5 measures in 3/4 time.")
-       (internal-class-name . "Sequential_music")
+to group start-mmrest, skip, stop-mmrest sequence. 
+
+Syntax @code{R2.*5} for 5 measures in 3/4 time.")
+       (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))
        ))
@@ -450,34 +500,38 @@ 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))
        ))
     
     (SlurEvent
      . (
-       (description . "Start or end slur. Syntax NOTE(  and )NOTE")
+       (description . "Start or end slur. 
+
+Syntax NOTE(    and )NOTE")
        (internal-class-name . "Event")
        (types . (general-music span-event slur-event))
        ))
 
-    (RevertProperty
+    (StartPlayingEvent
      . (
-       (description .  "The opposite of @ref{OverrideProperty}: remove a
-previously added property from a graphical object definition
- ")
+       (description .  "Used internally to signal beginning of notes.")
 
-       (internal-class-name . "Music")
-       (types . (general-music layout-instruction))
-       (iterator-ctor . ,      Pop_property_iterator::constructor)
+       (internal-class-name . "Event")
+       (types . (general-music event start-playing-event))
        ))
-
+    
     (OutputPropertySetMusic
      . (
        (description .  "Set grob properties in objects
-individually. Syntax @code{\\outputproperty @var{predicate} @var{prop}
+individually. 
+
+Syntax @code{\\outputproperty @var{predicate} @var{prop}
 = @var{val}}.")
 
        (internal-class-name . "Music")
@@ -492,20 +546,21 @@ individually. Syntax @code{\\outputproperty @var{predicate} @var{prop}
        (types . (general-music span-event text-span-event))
        ))
     
-    (ContextChange
+    (TrillSpanEvent
      . (
-       (description .  "Change staffs in Piano staff. Syntax @code{\\translator Staff = @var{new-id}}.")
-       (internal-class-name . "Music")
-       (iterator-ctor . , Change_iterator::constructor)
-       (types . (general-music translator-change-instruction))
+       (description . "Start a trill spanner tr~~~")
+       (internal-class-name . "Event")
+       (types . (general-music span-event trill-span-event))
        ))
     
     (TimeScaledMusic
      . (
-       (description .  "Multiply durations, as in tuplets. Syntax @code{\\times @var{fraction} @var{music}}, e.g.
+       (description .  "Multiply durations, as in tuplets. 
+
+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))
        ))
@@ -513,15 +568,17 @@ individually. Syntax @code{\\outputproperty @var{predicate} @var{prop}
     (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)) 
        ))
 
@@ -529,26 +586,28 @@ individually. Syntax @code{\\outputproperty @var{predicate} @var{prop}
      . (
        (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
      . (
@@ -563,17 +622,21 @@ For example, transposed music.")
        (description .  "Filler that takes up duration, does not print anything, and also
 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.
 
+
+
 Syntax: @code{s}@var{duration}")
 
        (internal-class-name . "Event")
@@ -610,7 +673,9 @@ Syntax: @code{s}@var{duration}")
     
     (StringNumberEvent
      . (
-       (description .  "Specify on which string to play this note. Syntax: @code{\\@var{number}}.")
+       (description .  "Specify on which string to play this note. 
+
+Syntax: @code{\\@var{number}}.")
 
        (internal-class-name . "Event")
        (types . (general-music string-number-event event))
@@ -644,7 +709,9 @@ Syntax: @code{s}@var{duration}")
     
     (VoiceSeparator
      . (
-       (description .  "Separate polyphonic voices in simultaneous music. Syntax: @code{\\\\}")
+       (description .  "Separate polyphonic voices in simultaneous music. 
+
+Syntax: @code{\\\\}")
 
        (internal-class-name . "Music")
        (types . (separator general-music))
@@ -653,10 +720,10 @@ Syntax: @code{s}@var{duration}")
     (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))
        ))
     
@@ -664,18 +731,18 @@ Syntax: @code{s}@var{duration}")
      . (
        (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))
        ))
     
@@ -683,22 +750,22 @@ Syntax: @code{s}@var{duration}")
      . (
        (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))
        ))
     ))
@@ -708,7 +775,6 @@ Syntax: @code{s}@var{duration}")
 
 (define music-name-to-property-table (make-vector 59 '()))
 
-
 ;; init hash table,
 ;; transport description to an object property.
 (set!
@@ -717,13 +783,11 @@ Syntax: @code{s}@var{duration}")
        (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)
@@ -749,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)
@@ -759,8 +822,7 @@ and values. E.g:
         (music-name (if (pair? handle)
                         (cdr handle)
                         (begin
-                          (ly:warn (string-append "Unknown repeat type `" name
-                                                  "'\nSee music-types.scm for supported repeats"))
+                          (ly:warn "Unknown repeat type `~S'\nSee music-types.scm for supported repeats" name)
                           'VoltaRepeatedMusic))))
     (make-music music-name)))