]> git.donarmstrong.com Git - lilypond.git/blob - scm/define-music-types.scm
* lily/sequential-iterator.cc (process): only process if moment >= 0.
[lilypond.git] / scm / define-music-types.scm
1
2 (define-public music-descriptions
3   `(
4     (AbsoluteDynamicEvent
5      . (
6    (description . "Creates a dynamic mark.  Syntax: @var{note}@code{\\x},
7 where x is one of \\ppp, \\pp, \\p, \\mp, \\mf, \\f, \\ff, \\fff.")
8         (internal-class-name . "Event")
9         (types . (general-music event dynamic-event absolute-dynamic-event))
10         ))
11     (ApplyContext
12      . (
13         (description . "Call the argument with the current context during interpreting phase")
14         (internal-class-name . "Music")
15         (types . (general-music apply-context))
16         (iterator-ctor . ,Apply_context_iterator::constructor)
17         ))
18     (ApplyOutputEvent
19      . (
20         (description . "
21 Call the argument with all current grobs during interpreting phase.
22
23 SYNTAX
24
25 \applyoutput FUNC
26
27 arguments to func are 1. the grob, 2. the originating context,
28 3. context where FUNC is called.
29
30 ")
31         (internal-class-name . "Event")
32         (iterator-ctor . ,Output_property_music_iterator::constructor)
33         (types . (general-music layout-instruction))
34         ))
35     (ArpeggioEvent 
36      . (
37         (description .  "Make an arpeggio on this note. Syntax:
38 @var{note}-@code{\\arpeggio}")
39         (internal-class-name .  "Event")
40         (types . (general-music arpeggio-event event))
41         ))
42
43     ;; todo: use articulation-event for slur as well.
44     ;; separate non articulation scripts  
45     (ArticulationEvent
46      . (
47    (description .  "Adds an articulation marking to a note.  Syntax:
48 @var{note}@code{X}@code{Y}, where X is a direction (up @code{^}, down
49 @code{_}, or LilyPond's choice (no direction specified)), and where Y
50 is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto},
51 @code{\\downbow}).  See the user manual for details.")
52
53         (internal-class-name . "Event")
54         (types . (general-music event articulation-event script-event))
55         )) 
56     (AutoChangeMusic
57      . (
58         (description .  "Used for making voices that switch between piano staves automatically.")
59
60         (internal-class-name . "Music_wrapper")
61         (iterator-ctor . ,Auto_change_iterator::constructor)
62         (types . (general-music music-wrapper-music auto-change-instruction))
63         ))
64     (BarCheck
65      . (
66         (description .
67                      "Check whether this music coincides with the start of the measure.")
68         (internal-class-name . "Music")
69         (types . (general-music bar-check))
70         (iterator-ctor . ,Bar_check_iterator::constructor)
71         ))
72     (BassFigureEvent
73      . (
74         (description .  "Print a bass-figure text")
75
76         (internal-class-name . "Event")
77         (types . (general-music event rhythmic-event bass-figure-event))
78         ))
79     (BeamEvent
80      . (
81    (description .  "Starts or stops a beam.  Syntax for manual control:
82 c8-[ c c-] c8")
83         (internal-class-name . "Event")
84         (types . (general-music event beam-event span-event))
85         ))
86     (BreakEvent
87      . (
88    (description .  "Creates a line break.  Syntax: \\break.")
89
90         (internal-class-name . "Event")
91         (types . (general-music break-event event))
92         ))
93     (BreathingSignEvent
94      . (
95         (description .  "Creates a `breath mark' or `comma'.  Syntax:
96 @var{note}\\breathe.")
97
98         (internal-class-name . "Event")
99         (types . (general-music event breathing-event))
100         )) 
101     (BusyPlayingEvent
102      . (
103         (description .  "Used internally to signal beginning and ending of notes.")
104
105         (internal-class-name . "Event")
106         (types . (general-music event busy-playing-event))
107         ))
108     (StartPlayingEvent
109      . (
110         (description .  "Used internally to signal beginning of notes.")
111
112         (internal-class-name . "Event")
113         (types . (general-music event start-playing-event))
114         ))
115     
116     (ClusterNoteEvent
117      . (
118         (description .  "A note that is part of a cluster.")
119         (internal-class-name . "Event")
120
121         ; not a note-event, to ensure that Note_engraver doesn't eat it. 
122         (types . (general-music cluster-note-event melodic-event rhythmic-event event))
123         ))
124     
125     (ContextSpeccedMusic
126      . (
127         (description .  "Interpret the argument music within a specific context.")
128         (iterator-ctor . ,Context_specced_music_iterator::constructor)
129         (internal-class-name . "Music_wrapper")
130         (types . (context-specification general-music music-wrapper-music))
131         ))
132     
133     (CrescendoEvent
134      . (
135         (description .  "Begins or ends a crescendo.  Syntax: @var{note}\\cr
136 ... @var{note}\\rc (you can also use \\<, \\!, \\cresc, and
137 \\endcresc.  See the user manual for details.).")
138
139         (internal-class-name . "Event")
140         (types . (general-music dynamic-event crescendo-event event))
141         )) 
142     (DecrescendoEvent
143      . (
144         (description .  "See @ref{CrescendoEvent}.")
145
146         (internal-class-name . "Event")
147         (types . (general-music dynamic-event decrescendo-event event))
148         ))
149  
150     (ExtenderEvent
151      . (
152         (description .  "Extend lyrics.")
153
154         (internal-class-name . "Event")
155         (types . (general-music extender-event event))
156         ))
157     (FingerEvent
158      . (
159         (description . "Specify what finger to use for this note.")
160         (internal-class-name . "Event")
161         (types . (general-music fingering-event event))
162         ))
163     (BeamForbidEvent
164      . (
165         (description . "Specify that a note may not auto-beamed ")
166         (internal-class-name . "Event")
167         (types . (general-music event beam-forbid-event))
168         ))
169     (GlissandoEvent
170      . (
171         (description .  "Start  a glissando on this note.")
172         (internal-class-name . "Event")
173         (types . (general-music glissando-event event))
174         ))
175     
176     (GraceMusic
177      . (
178         (description .  "Interpret the argument as grace notes. ")
179
180         (internal-class-name . "Grace_music")
181         (iterator-ctor . ,Grace_iterator::constructor)
182         (types . (grace-music music-wrapper-music general-music))
183         ))
184     (NoteGroupingEvent
185      . (
186         (description . "Start or stop grouping brackets.")
187         (internal-class-name . "Event")
188         (types . (general-music event note-grouping-event))
189         ))
190     (HarmonicEvent
191      . (
192         (description . "Mark a note as harmonic")
193         (internal-class-name . "Event")
194         (types . (general-music event harmonic-event))
195         ))
196     (HyphenEvent
197      . (
198         (description .  "A hyphen between lyric syllables.")
199
200         (internal-class-name . "Event")
201         (types . (general-music hyphen-event event))
202         ))
203     
204     (KeyChangeEvent
205      . (
206         (description .  "Change the key signature. Syntax: @code{\\key } @var{name} @var{scale}.")
207
208         (internal-class-name . "Key_change_ev")
209         (types . (general-music key-change-event event))
210         ))
211     
212     (LigatureEvent
213      . (
214         (description .  "(docme).")
215
216         (internal-class-name . "Event")
217         (span-type . ligature)
218         (types . (general-music span-event ligature-event event))
219         ))
220     
221     (LyricCombineMusic
222      . (
223         (description .  "Align lyrics to the start of notes.
224 Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
225
226         (internal-class-name . "Lyric_combine_music")
227         (types . (general-music lyric-combine-music))
228         (iterator-ctor . ,Lyric_combine_music_iterator::constructor)
229         ))
230     
231     (NewLyricCombineMusic
232      . (
233         (description .  "Align lyrics to the start of notes.
234 Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
235         (internal-class-name . "Music")
236         (length . ,(ly:make-moment 0 1))
237         (types . (general-music lyric-combine-music))
238         (iterator-ctor . ,New_lyric_combine_music_iterator::constructor)
239         ))
240
241     (LyricEvent
242      . (
243         (description .  "A lyric syllable. Must be entered in lyrics mode, i.e.
244 @code{\\lyrics @{ twinkle4 twinkle4 @} } .")
245
246         (internal-class-name . "Event")
247         (types . (general-music rhythmic-event lyric-event event))
248         ))
249     (MarkEvent
250      . (
251         (description .  "Insert a rehearsal mark. Syntax: @code{\\mark} @var{marker},
252 e.g. @code{\\mark \"A\"}.")
253
254         (internal-class-name . "Event")
255         (types . (general-music mark-event event))
256         ))
257     (MelismaPlayingEvent
258      . (
259         (description .  "Used internally to signal melismas.")
260         (internal-class-name . "Event")
261         (types . (general-music melisma-playing-event event))
262         ))
263     (ManualMelismaEvent
264      . (
265         (description .  "Start or stop a melisma.
266
267 Syntax:@code{c4\\melisma d\\melismaEnd}.")
268         (internal-class-name . "Event")
269         (types . (general-music melisma-span-event event))
270         ))
271     
272     (MultiMeasureRestEvent
273      . (
274         (description . "Rests that may be compressed into Multi rests. Syntax
275 @code{R2.*4} for 4 measures in 3/4 time. Note the capital R.")
276         (internal-class-name . "Event")
277         (types . (general-music event rhythmic-event multi-measure-rest-event))
278         ))
279     
280     (MultiMeasureTextEvent
281      . (
282         (description . "Texts on mm rests. Syntax
283 @code{R-\\markup @{ \\roman \"bla\" @}}. Note the explicit font switch.")
284         (internal-class-name . "Event")
285         (types . (general-music event multi-measure-text-event))
286         ))
287
288     (Music
289      . (
290         (description .  "Generic type for music expressions.")
291
292         (internal-class-name . "Music")
293         (types . (general-music)) 
294         ))
295     (NoteEvent
296      . (
297         (description .  "A note.")
298
299         (internal-class-name . "Event")
300         (types . (general-music event note-event rhythmic-event melodic-event))
301         ))
302     
303     (OverrideProperty
304      . (
305         (description .  "Extend the definition of a graphical object.
306
307 SYNTAX
308
309 @code{\\propery Foo.Bar \\override} @var{SYMBOL} = @var{VALUE}
310
311 ")
312
313         (internal-class-name . "Music")
314         (types . (general-music layout-instruction))
315         (iterator-ctor . ,      Push_property_iterator::constructor)
316         ))
317     (PartCombineMusic
318      . (
319         (description .  "Combine two parts on a staff, either merged or
320 as separate voices.")
321
322         (internal-class-name . "Simultaneous_music")
323         (types . (general-music part-combine-music))
324         (iterator-ctor . ,Part_combine_iterator::constructor)
325         ))
326     (PhrasingSlurEvent
327      . (
328         (description . "Start or end phrasing slur. Syntax NOTE \\(  and \\) NOTE")
329         (internal-class-name . "Event")
330         (types . (general-music span-event phrasing-slur-event))
331         ))
332     
333     (PropertySet
334      . (
335         (description .  "Set a context property.
336
337 Syntax: @code{\\property @var{context}.@var{prop} = @var{scheme-val}}.")
338         (internal-class-name . "Music")
339         (types . (layout-instruction general-music))
340         (iterator-ctor . ,Property_iterator::constructor)
341         )
342      )
343     
344     (PropertyUnset
345      . (
346         (description .  "Remove the definition of a context @code{\\property}.")
347
348         (internal-class-name . "Music")
349         (types . (layout-instruction general-music))
350         (iterator-ctor . ,Property_unset_iterator::constructor)
351         )
352      )
353     
354     (PesOrFlexaEvent
355      . (
356         (description .  "Within a ligature, mark the previous and the
357 following note to form a pes (if melody goes up) or a flexa (if melody
358 goes down).")
359
360         (internal-class-name . "Event")
361         (types . (general-music pes-or-flexa-event event))
362         ))
363
364     (QuoteMusic
365      . (
366         (description . "Quote preprocessed snippets of music. ")
367         (internal-class-name . "Event") ;;  so we get Event::get_length ().
368         (iterator-ctor . ,Quote_iterator::constructor)
369         (types . (general-music))
370         ))
371     
372     (RelativeOctaveCheck
373      . ((description . "Check if a pitch is in the correct octave.")
374         (internal-class-name . "Relative_octave_check")
375         (types . (general-music relative-octave-check))
376         ))
377     
378     (RepeatedMusic
379      . (
380         (description .  "Repeat music in different ways")
381
382         (type .  repeated-music)
383         (types . (general-music repeated-music))
384         ))
385     
386     (Event
387      . (
388         (description .  "Atomic music event.")
389
390         (internal-class-name . "Event")
391         (types . (general-music event))
392         ))
393     
394     (RestEvent
395      . (
396         (description .  "A Rest. Syntax @code{r4} for a quarter rest. ")
397
398         (internal-class-name . "Event")
399         (types . (general-music event rhythmic-event rest-event))
400         )) 
401     (SequentialMusic
402      . (
403         (description .  "Music expressions concatenated. Syntax \\sequential @{..@} or simply @{..@} .")
404
405         (internal-class-name . "Sequential_music")
406         (iterator-ctor . ,Sequential_music_iterator::constructor)
407         (types . (general-music sequential-music))
408         ))
409     
410     (MultiMeasureRestMusicGroup
411      . (
412         (description .  "Like sequential-music, but specifically intended
413 to group start-mmrest, skip, stop-mmrest sequence. Syntax @code{R2.*5} for 5 measures in 3/4 time.")
414         (internal-class-name . "Sequential_music")
415         (iterator-ctor . ,Sequential_music_iterator::constructor)
416         (types . (general-music sequential-music))
417         ))
418
419     (SoloOneEvent
420      . (
421         (description . "Print Solo.1")
422         (internal-class-name . "Event")
423         (part-combine-status . solo1)
424         (types . (general-music event part-combine-event))
425         ))
426     (SoloTwoEvent
427      . (
428         (description . "Print Solo.2")
429         (internal-class-name . "Event")
430         (part-combine-status . solo2)
431         (types . (general-music event part-combine-event))
432         ))
433     (UnisonoEvent
434      . ((description . "Print a2")
435         (internal-class-name .  "Event")
436         (part-combine-status . unisono)
437         (types . (general-music event part-combine-event))))
438     
439     (SimultaneousMusic
440      . (
441         (description .  "Music playing together.
442
443 SYNTAX
444
445 @code{ \\simultaneous @{ .. @}} or < .. >.")
446
447         (internal-class-name . "Simultaneous_music")
448         (iterator-ctor . ,Simultaneous_music_iterator::constructor)
449         
450         (types . (general-music simultaneous-music))
451         ))
452     
453     (SlurEvent
454      . (
455         (description . "Start or end slur. Syntax NOTE(  and )NOTE")
456         (internal-class-name . "Event")
457         (types . (general-music span-event slur-event))
458         ))
459
460     (RevertProperty
461      . (
462         (description .  "The opposite of @ref{OverrideProperty}: remove a
463 previously added property from a graphical object definition
464  ")
465
466         (internal-class-name . "Music")
467         (types . (general-music layout-instruction))
468         (iterator-ctor . ,      Pop_property_iterator::constructor)
469         ))
470
471     (OutputPropertySetMusic
472      . (
473         (description .  "Set grob properties in objects
474 individually. Syntax @code{\\outputproperty @var{predicate} @var{prop}
475 = @var{val}}.")
476
477         (internal-class-name . "Music")
478         (iterator-ctor . ,Output_property_music_iterator::constructor)
479         (types . (general-music layout-instruction))
480         ))
481     
482     (TextSpanEvent
483      . (
484         (description . "Start a text spanner like 8va.....|")
485         (internal-class-name . "Event")
486         (types . (general-music span-event text-span-event))
487         ))
488     
489     (TranslatorChange
490      . (
491         (description .  "Change staffs in Piano staff. Syntax @code{\\translator Staff = @var{new-id}}.")
492         (internal-class-name . "Music")
493         (iterator-ctor . , Change_iterator::constructor)
494         (types . (general-music translator-change-instruction))
495         ))
496     
497     (TimeScaledMusic
498      . (
499         (description .  "Multiply durations, as in tuplets. Syntax @code{\\times @var{fraction} @var{music}}, e.g.
500 @code{\\times 2/3 @{ ... @}} for triplets.
501  ")
502         (internal-class-name . "Time_scaled_music")
503         (iterator-ctor . ,Time_scaled_music_iterator::constructor)
504         (types . (time-scaled-music music-wrapper-music general-music))
505         ))
506     
507     (TransposedMusic
508      . (
509         (description .  "Music that has been transposed.")
510         (internal-class-name . "Transposed_music")
511         (types . (music-wrapper-music general-music transposed-music))
512         ))
513
514     (UntransposableMusic
515      . (
516         (description .  "Music that can not be transposed.")
517
518         (internal-class-name . "Untransposable_music")
519         (types . (music-wrapper-music general-music untransposable-music)) 
520         ))
521
522     (UnrelativableMusic
523      . (
524         (description .  "Music that can not be converted from relative to absolute notation.
525 For example, transposed music.")
526         (internal-class-name . "Un_relativable_music")
527         (types . (music-wrapper-music general-music unrelativable-music))
528         ))
529
530     (RelativeOctaveMusic
531      . (
532         (description .  "Music that was entered in relative octave notation.")
533
534         (internal-class-name . "Relative_octave_music")
535         (types . (music-wrapper-music general-music relative-octave-music))
536         ))
537     
538     (EventChord
539      . (
540         (description .  "Internally used to group a set of events.")
541         (internal-class-name . "Event_chord")
542         (iterator-ctor . ,Event_chord_iterator::constructor)
543         (types . (general-music event-chord simultaneous-music))
544         )
545      )
546     
547     (ScriptEvent
548      . (
549         (description .  "Add an articulation mark to a note. ")
550
551         (internal-class-name . "Event")
552         (types . (general-music event))
553         ))
554
555     (SkipMusic
556      . (
557         (description .  "Filler that takes up duration, does not print anything, and also
558 does not create staffs or voices implicitly.
559
560 Syntax: @code{\\skip }@var{duration}.")
561         (internal-class-name . "Music")
562         (length . ,ly:music-duration-length)
563         (iterator-ctor . ,Simple_music_iterator::constructor)
564         (types . (general-music event rhythmic-event skip-event))
565         ))
566      
567     (SkipEvent
568      . (
569         (description .  "Filler that takes up duration, but does not print anything.
570
571 Syntax: @code{s}@var{duration}")
572
573         (internal-class-name . "Event")
574         (types . (general-music event rhythmic-event skip-event))
575         ))
576     (SpanEvent
577      . (
578         (description .  "Event for anything that is started at a different time than stopped.")
579
580         (internal-class-name . "Event")
581         (types . (general-music event))
582         ))
583     
584     (SustainEvent
585      . (
586         (description . "Depress or release sustain pedal. ")
587         (internal-class-name . "Event")
588         (types . (general-music pedal-event sustain-pedal-event))
589         ))
590     
591     (SostenutoEvent
592      . (
593         (description . "Depress or release sostenuto pedal. ")
594         (internal-class-name . "Event")
595         (types . (general-music pedal-event sostenuto-pedal-event))
596         ))
597     
598     (UnaCordaEvent
599      . (
600         (description . "Depress or release una-corda pedal.")
601         (internal-class-name . "Event")
602         (types . (general-music pedal-event una-corda-pedal-event))
603         ))
604     
605     (StringNumberEvent
606      . (
607         (description .  "Specify on which string to play this note. Syntax: @code{\\@var{number}}.")
608
609         (internal-class-name . "Event")
610         (types . (general-music string-number-event event))
611         )) 
612
613     (MetronomeChangeEvent
614      . (
615         (description .  "Change tempo setting (in beats per minute).")
616         (internal-class-name . "Event")
617         (types . (general-music metronome-change-event tempo-event event))
618         ))
619     
620     (TextScriptEvent
621      . (
622         (description .  "")
623         (internal-class-name . "Event")
624         (types . (general-music script-event text-script-event event))
625         )) 
626     (TieEvent
627      . (
628         (description .  "A tie.  Entered as @var{note}-~.")
629         (internal-class-name . "Event")
630         (types . (general-music tie-event event))
631         ))
632     (TremoloEvent
633      . (
634         (description . "Un measured tremolo.")
635         (internal-class-name . "Event")
636         (types . (general-music event tremolo-event))
637         ))
638     
639     (VoiceSeparator
640      . (
641         (description .  "Separate polyphonic voices in simultaneous music. Syntax: @code{\\\\}")
642
643         (internal-class-name . "Music")
644         (types . (separator general-music))
645         ))
646
647     (VoltaRepeatedMusic
648      . (
649         (iterator-ctor . ,Volta_repeat_iterator::constructor)
650         (internal-class-name . "Repeated_music")
651         (description . "")
652         (start-moment-function .  ,Repeated_music::first_start)
653         (length . ,Repeated_music::volta_music_length)
654         (types . (general-music repeated-music volta-repeated-music))
655         ))
656     
657     (UnfoldedRepeatedMusic
658      . (
659         (iterator-ctor . ,Unfolded_repeat_iterator::constructor)
660         (description .  "")
661         (start-moment-function .  ,Repeated_music::first_start)
662         (internal-class-name . "Repeated_music")
663         (types . (general-music repeated-music unfolded-repeated-music))
664         (length . ,Repeated_music::unfolded_music_length)
665         ))
666     (PercentRepeatedMusic
667      . (
668         (internal-class-name . "Repeated_music")
669         (description .  "Repeats encoded by percents.")
670         (iterator-ctor . ,Percent_repeat_iterator::constructor)
671         (start-moment-function .  ,Repeated_music::first_start)
672         (length . ,Repeated_music::unfolded_music_length)
673         (types . (general-music repeated-music percent-repeated-music))
674         ))
675     
676     (TremoloRepeatedMusic
677      . (
678         (iterator-ctor . ,Chord_tremolo_iterator::constructor)
679         (description .  "Repeated notes denoted by tremolo beams.")
680         (internal-class-name . "Repeated_music")
681         (start-moment-function .  ,Repeated_music::first_start)
682
683         ;; the length of the repeat is handled by shifting the note logs
684         (length . ,Repeated_music::folded_music_length)
685         (types . (general-music repeated-music tremolo-repeated-music))
686         
687         ))
688     
689     (FoldedRepeatedMusic
690      . (
691         (internal-class-name . "Repeated_music")
692         (description .  "Repeats with alternatives placed in parallel. ")
693         (iterator-ctor  . ,Folded_repeat_iterator::constructor)
694         (start-moment-function .  ,Repeated_music::minimum_start)
695         (length . ,Repeated_music::folded_music_length)
696         (types . (general-music repeated-music folded-repeated-music))
697         ))
698     ))
699
700 (set! music-descriptions
701       (sort music-descriptions alist<?))
702
703 (define music-name-to-property-table (make-vector 59 '()))
704
705
706 ;; init hash table,
707 ;; transport description to an object property.
708 (set!
709  music-descriptions
710  (map (lambda (x)
711         (set-object-property! (car x)
712                               'music-description
713                               (cdr (assq 'description (cdr x))))
714         (let
715             ((l (cdr x)))
716           (set! l (assoc-set! l 'name (car x)))
717           (set! l (assq-remove!  l 'description))
718           (hashq-set! music-name-to-property-table (car x) l)
719           (cons (car x) l)
720           ))
721       music-descriptions))
722
723
724
725 (define-public (make-music-by-name x)
726   (if (not (symbol? x))
727       (error (format "Not a symbol: ~a" x)))
728   (let*
729       (
730        (props (hashq-ref music-name-to-property-table x '()))
731        (name (if (pair? props)
732                  (cdr (assoc 'internal-class-name props))
733                  (error "Can not find music object" x)))
734        )
735
736     (if (eq? props '())
737         (ly:warn (format "Could not find music type `~a'" x)))  
738     (ly:make-bare-music name props)
739     ))
740
741
742
743 (define-public (make-repeated-music name)
744   (let*
745       (
746        (handle (assoc
747                 name
748                 '(("volta" . VoltaRepeatedMusic)
749                   ("unfold" . UnfoldedRepeatedMusic)
750                   ("percent" . PercentRepeatedMusic)
751                   ("tremolo" . TremoloRepeatedMusic)
752                   ("fold" . FoldedRepeatedMusic)
753                   )))
754        (music-name
755         (if (pair? handle)
756             (cdr handle)
757             (begin
758               (ly:warn
759                (string-append "Unknown repeat type `" name
760                               "'\nSee music-types.scm for supported repeats"))
761               'VoltaRepeatedMusic)
762             )
763         )
764        )
765
766     (make-music-by-name music-name)
767     ))
768