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