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