]> git.donarmstrong.com Git - lilypond.git/blob - scm/define-music-types.scm
Fix #305: Allow alignment spanner to be broken for dynamics.
[lilypond.git] / scm / define-music-types.scm
1 ;;;; This file is part of LilyPond, the GNU music typesetter.
2 ;;;;
3 ;;;; Copyright (C) 1998--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
4 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
5 ;;;;
6 ;;;; LilyPond is free software: you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation, either version 3 of the License, or
9 ;;;; (at your option) any later version.
10 ;;;;
11 ;;;; LilyPond is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;;;; GNU General Public License for more details.
15 ;;;;
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18
19 ;; TODO: should link back into user manual.
20
21 (define (mm-rest-child-list music)
22   "Generate events for multimeasure rests,
23 to be used by the sequential-iterator"
24   (let ((location (ly:music-property music 'origin))
25         (duration (ly:music-property music 'duration)))
26     (list (make-music 'BarCheck
27                       'origin location)
28           (make-event-chord (cons (make-music 'MultiMeasureRestEvent
29                                               'origin location
30                                               'duration duration)
31                                   (ly:music-property music 'articulations)))
32           (make-music 'BarCheck
33                       'origin location))))
34
35 (define-public music-descriptions
36   `(
37     (AbsoluteDynamicEvent
38      . ((description . "Create a dynamic mark.
39
40 Syntax: @var{note}@code{\\x}, where @code{\\x} is a dynamic mark like
41 @code{\\ppp} or @code{\\sfz}.  A complete list is in file
42 @file{ly/@/dynamic-scripts-init.ly}.")
43         (types . (general-music event dynamic-event absolute-dynamic-event))
44         ))
45
46     (AnnotateOutputEvent
47      . ((description . "Print an annotation of an output element.")
48         (types . (general-music event annotate-output-event))
49         ))
50
51     (ApplyContext
52      . ((description . "Call the argument with the current context during
53 interpreting phase.")
54         (types . (general-music apply-context))
55         (iterator-ctor . ,ly:apply-context-iterator::constructor)
56         ))
57
58     (ApplyOutputEvent
59      . ((description . "Call the argument with all current grobs during
60 interpreting phase.
61
62 Syntax: @code{\\applyOutput #'@var{context} @var{func}}
63
64 Arguments to @var{func} are 1.@tie{}the grob, 2.@tie{}the originating
65 context, and 3.@tie{}the context where @var{func} is called.")
66         (types . (general-music event apply-output-event))
67         ))
68
69     (ArpeggioEvent
70      . ((description . "Make an arpeggio on this note.
71
72 Syntax: @var{note}@code{-\\arpeggio}")
73         (types . (general-music arpeggio-event event))
74         ))
75
76     ;; todo: use articulation-event for slur as well.
77     ;; separate non articulation scripts
78     (ArticulationEvent
79      . ((description . "Add an articulation marking to a note.
80
81 Syntax: @var{note}@code{x}@code{y}, where @code{x} is a direction
82 (@code{^} for up or @code{_} for down), or LilyPond's choice
83 (no direction specified), and where @code{y} is an articulation
84 (such as @code{-.}, @code{->}, @code{\\tenuto}, @code{\\downbow}).
85 See the Notation Reference for details.")
86         (types . (general-music event articulation-event script-event))
87         ))
88
89     (AutoChangeMusic
90      . ((description . "Used for making voices that switch between
91 piano staves automatically.")
92         (iterator-ctor . ,ly:auto-change-iterator::constructor)
93         (start-callback . ,ly:music-wrapper::start-callback)
94         (length-callback . ,ly:music-wrapper::length-callback)
95         (types . (general-music music-wrapper-music auto-change-instruction))
96         ))
97
98     (BarCheck
99      . ((description . "Check whether this music coincides with
100 the start of the measure.")
101         (types . (general-music bar-check))
102         (iterator-ctor . ,ly:bar-check-iterator::constructor)
103         ))
104
105     (BassFigureEvent
106      . ((description . "Print a bass-figure text.")
107         (types . (general-music event rhythmic-event bass-figure-event))
108         ))
109
110     (BeamEvent
111      . ((description . "Start or stop a beam.
112
113 Syntax for manual control: @code{c8-[ c c-] c8}")
114         (types . (general-music event beam-event span-event))
115         ))
116
117     (BeamForbidEvent
118      . ((description . "Specify that a note may not auto-beamed.")
119         (types . (general-music event beam-forbid-event))
120         ))
121
122     (BreakDynamicSpanEvent
123      . ((description . "End an alignment spanner for dynamics here.")
124         (types . (general-music break-span-event break-dynamic-span-event event))
125         ))
126
127     (BendAfterEvent
128      . ((description . "A drop/fall/doit jazz articulation.")
129         (types . (general-music bend-after-event event))))
130
131     (BreathingEvent
132      . ((description . "Create a @q{breath mark} or @q{comma}.
133
134 Syntax: @var{note}@code{\\breathe}")
135
136         (types . (general-music event breathing-event))
137         ))
138
139     (ClusterNoteEvent
140      . ((description . "A note that is part of a cluster.")
141         ;; not a note-event, to ensure that Note_heads_engraver doesn't eat it.
142         (types . (general-music cluster-note-event melodic-event
143                   rhythmic-event event))
144         ))
145
146     (CompletizeExtenderEvent
147      . ((description . "Used internally to signal the end of a lyrics block to
148 ensure extenders are completed correctly when a @code{Lyrics} context ends
149 before its associated @code{Voice} context.")
150         (types . (general-music completize-extender-event event))
151         ))
152
153     (ContextChange
154      . ((description . "Change staves in Piano staff.
155
156 Syntax: @code{\\change Staff = @var{new-id}}")
157         (iterator-ctor . ,ly:change-iterator::constructor)
158         (types . (general-music translator-change-instruction))
159         ))
160
161     (ContextSpeccedMusic
162      . ((description . "Interpret the argument music within a
163 specific context.")
164         (iterator-ctor . ,ly:context-specced-music-iterator::constructor)
165         (length-callback . ,ly:music-wrapper::length-callback)
166         (start-callback . ,ly:music-wrapper::start-callback)
167         (types . (context-specification general-music music-wrapper-music))
168         ))
169
170     (CrescendoEvent
171      . ((description . "Begin or end a crescendo.
172
173 Syntax: @var{note}@code{\\<} @dots{} @var{note}@code{\\!}
174
175 An alternative syntax is @var{note}@code{\\cr} @dots{}
176 @var{note}@code{\\endcr}.")
177         (types . (general-music span-event span-dynamic-event crescendo-event
178                   event))
179         ))
180
181     (DecrescendoEvent
182      . ((description . "Begin or end a decrescendo.
183
184 Syntax: @var{note}@code{\\>} @dots{} @var{note}@code{\\!}
185
186 An alternative syntax is @var{note}@code{\\decr} @dots{}
187 @var{note}@code{\\enddecr}.")
188         (types . (general-music span-event span-dynamic-event decrescendo-event
189                   event))
190         ))
191
192     (EpisemaEvent
193      . ((description . "Begin or end an episema.")
194         (types . (general-music span-event event episema-event))
195         ))
196
197     (Event
198      . ((description . "Atomic music event.")
199         (types . (general-music event))
200         ))
201
202     (EventChord
203      . ((description . "Internally used to group a set of events.")
204         (iterator-ctor . ,ly:event-chord-iterator::constructor)
205         (length-callback . ,ly:music-sequence::maximum-length-callback)
206         (to-relative-callback .
207          ,ly:music-sequence::event-chord-relative-callback)
208         (types . (general-music event-chord simultaneous-music))
209         ))
210
211     (ExtenderEvent
212      . ((description . "Extend lyrics.")
213         (types . (general-music extender-event event))
214         ))
215
216     (FingeringEvent
217      . ((description . "Specify what finger to use for this note.")
218         (types . (general-music fingering-event event))
219         ))
220
221     (GlissandoEvent
222      . ((description . "Start a glissando on this note.")
223         (types . (general-music glissando-event event))
224         ))
225
226     (GraceMusic
227      . ((description . "Interpret the argument as grace notes.")
228         (start-callback . ,ly:grace-music::start-callback)
229         (length . ,ZERO-MOMENT)
230         (iterator-ctor . ,ly:grace-iterator::constructor)
231         (types . (grace-music music-wrapper-music general-music))
232         ))
233
234     (HarmonicEvent
235      . ((description . "Mark a note as harmonic.")
236         (types . (general-music event harmonic-event))
237         ))
238
239     (HyphenEvent
240      . ((description . "A hyphen between lyric syllables.")
241         (types . (general-music hyphen-event event))
242         ))
243
244     (KeyChangeEvent
245      . ((description . "Change the key signature.
246
247 Syntax: @code{\\key} @var{name} @var{scale}")
248         (to-relative-callback . ,(lambda (x p) p))
249         (types . (general-music key-change-event event))
250         ))
251
252     (LabelEvent
253      . ((description . "Place a bookmarking label.")
254         (types . (general-music label-event event))
255         ))
256
257     (LaissezVibrerEvent
258      . ((description . "Don't damp this chord.
259
260 Syntax: @var{note}@code{\\laissezVibrer}")
261         (types . (general-music event laissez-vibrer-event))
262         ))
263
264     (LigatureEvent
265      . ((description . "Start or end a ligature.")
266         (types . (general-music span-event ligature-event event))
267         ))
268
269     (LineBreakEvent
270      . ((description . "Allow, forbid or force a line break.")
271         (types . (general-music line-break-event break-event event))
272         ))
273
274     (LyricCombineMusic
275      . ((description . "Align lyrics to the start of notes.
276
277 Syntax: @code{\\lyricsto} @var{voicename} @var{lyrics}")
278         (length . ,ZERO-MOMENT)
279         (types . (general-music lyric-combine-music))
280         (iterator-ctor . ,ly:lyric-combine-music-iterator::constructor)
281         ))
282
283     (LyricEvent
284      . ((description . "A lyric syllable.  Must be entered in lyrics mode,
285 i.e., @code{\\lyrics @{ twinkle4 twinkle4 @} }.")
286         (types . (general-music rhythmic-event lyric-event event))
287         ))
288
289     (MarkEvent
290      . ((description . "Insert a rehearsal mark.
291
292 Syntax: @code{\\mark} @var{marker}
293
294 Example: @code{\\mark \"A\"}")
295         (types . (general-music mark-event event))
296         ))
297
298     (MultiMeasureRestEvent
299      . ((description . "Used internally by @code{MultiMeasureRestMusic}
300 to signal rests.")
301         (types . (general-music event rhythmic-event
302                   multi-measure-rest-event))
303         ))
304
305     (MultiMeasureRestMusic
306      . ((description . "Rests that may be compressed into Multi rests.
307
308 Syntax: @code{R2.*4} for 4 measures in 3/4 time.")
309         (iterator-ctor . ,ly:sequential-iterator::constructor)
310         (elements-callback . ,mm-rest-child-list)
311         (types . (general-music multi-measure-rest))
312         ))
313
314     (MultiMeasureTextEvent
315      . ((description . "Texts on multi measure rests.
316
317 Syntax: @code{R-\\markup @{ \\roman \"bla\" @}}
318
319 Note the explicit font switch.")
320         (types . (general-music event multi-measure-text-event))
321         ))
322
323     (Music
324      . ((description . "Generic type for music expressions.")
325         (types . (general-music))
326         ))
327
328     (NoteEvent
329      . ((description . "A note.")
330         (types . (general-music event note-event rhythmic-event
331                   melodic-event))
332         ))
333
334     (NoteGroupingEvent
335      . ((description . "Start or stop grouping brackets.")
336         (types . (general-music event note-grouping-event))
337         ))
338
339     (OverrideProperty
340      . ((description . "Extend the definition of a graphical object.
341
342 Syntax: @code{\\override} [ @var{context} @code{.} ]
343 @var{object} @var{property} @code{=} @var{value}")
344         (types . (general-music layout-instruction-event
345                   override-property-event))
346         (iterator-ctor . ,ly:push-property-iterator::constructor)
347         ))
348
349     (PageBreakEvent
350      . ((description . "Allow, forbid or force a page break.")
351         (types . (general-music break-event page-break-event event))
352         ))
353
354     (PageTurnEvent
355      . ((description . "Allow, forbid or force a page turn.")
356         (types . (general-music break-event page-turn-event event))
357         ))
358
359     (PartCombineMusic
360      . ((description . "Combine two parts on a staff, either merged or
361 as separate voices.")
362         (length-callback . ,ly:music-sequence::maximum-length-callback)
363         (start-callback . ,ly:music-sequence::minimum-start-callback)
364         (types . (general-music part-combine-music))
365         (iterator-ctor . ,ly:part-combine-iterator::constructor)
366         ))
367
368     (PercentEvent
369      . ((description . "Used internally to signal percent repeats.")
370         (types . (general-music event percent-event rhythmic-event))
371         ))
372
373     (PercentRepeatedMusic
374      . ((description . "Repeats encoded by percents.")
375         (iterator-ctor . ,ly:percent-repeat-iterator::constructor)
376         (start-callback .  ,ly:repeated-music::first-start)
377         (length-callback . ,ly:repeated-music::unfolded-music-length)
378         (types . (general-music repeated-music percent-repeated-music))
379         ))
380
381     (PesOrFlexaEvent
382      . ((description . "Within a ligature, mark the previous and the
383 following note to form a pes (if melody goes up) or a flexa (if melody
384 goes down).")
385         (types . (general-music pes-or-flexa-event event))
386         ))
387
388     (PhrasingSlurEvent
389      . ((description . "Start or end phrasing slur.
390
391 Syntax: @var{note}@code{\\(} and @var{note}@code{\\)}")
392         (types . (general-music span-event event phrasing-slur-event))
393         ))
394
395     (PropertySet
396      . ((description . "Set a context property.
397
398 Syntax: @code{\\set @var{context}.@var{prop} = @var{scheme-val}}")
399         (types . (layout-instruction-event general-music))
400         (iterator-ctor . ,ly:property-iterator::constructor)
401         ))
402
403     (PropertyUnset
404      . ((description . "Restore the default setting for a context
405 property.  See @ref{PropertySet}.
406
407 Syntax: @code{\\unset @var{context}.@var{prop}}")
408         (types . (layout-instruction-event general-music))
409         (iterator-ctor . ,ly:property-unset-iterator::constructor)
410         ))
411
412     (QuoteMusic
413      . ((description . "Quote preprocessed snippets of music.")
414         (iterator-ctor . ,ly:music-wrapper-iterator::constructor)
415         (length-callback . ,ly:music-wrapper::length-callback)
416         (start-callback . ,ly:music-wrapper::start-callback)
417         (types . (general-music music-wrapper-music))
418         ))
419
420     (RelativeOctaveCheck
421      . ((description . "Check if a pitch is in the correct octave.")
422         (to-relative-callback . ,ly:relative-octave-check::relative-callback)
423         (types . (general-music relative-octave-check))
424         ))
425
426     (RelativeOctaveMusic
427      . ((description . "Music that was entered in relative octave notation.")
428         (to-relative-callback . ,ly:relative-octave-music::relative-callback)
429         (iterator-ctor . ,ly:music-wrapper-iterator::constructor)
430         (length-callback . ,ly:music-wrapper::length-callback)
431         (start-callback . ,ly:music-wrapper::start-callback)
432         (types . (music-wrapper-music general-music relative-octave-music))
433         ))
434
435     (RepeatedChord
436      . ((description . "A chord repetition")
437         (to-relative-callback . ,ly:music-sequence::repeated-chord-relative-callback)
438         (iterator-ctor . ,ly:music-wrapper-iterator::constructor)
439         (start-callback . ,ly:music-wrapper::start-callback)
440         (length-callback . ,ly:music-wrapper::length-callback)
441         (types . (general-music music-wrapper-music))
442         ))
443
444     (RepeatedMusic
445      . ((description . "Repeat music in different ways.")
446         (types . (general-music repeated-music))
447         ))
448
449     (RepeatTieEvent
450      . ((description . "Ties for starting a second volta bracket.")
451         (types . (general-music event repeat-tie-event))
452         ))
453
454     (RestEvent
455      . ((description . "A Rest.
456
457 Syntax: @code{r4} for a quarter rest.")
458         (types . (general-music event rhythmic-event rest-event))
459         ))
460
461     (RevertProperty
462      . ((description . "The opposite of @ref{OverrideProperty}: remove a
463 previously added property from a graphical object definition.")
464         (types . (general-music layout-instruction-event))
465         (iterator-ctor . ,ly:pop-property-iterator::constructor)
466         ))
467
468     (ScriptEvent
469      . ((description . "Add an articulation mark to a note.")
470         (types . (general-music event))
471         ))
472
473     (SequentialMusic
474      . ((description . "Music expressions concatenated.
475
476 Syntax: @code{\\sequential @{ @dots{} @}} or simply @code{@{ @dots{} @}}")
477         (length-callback . ,ly:music-sequence::cumulative-length-callback)
478         (start-callback . ,ly:music-sequence::first-start-callback)
479         (elements-callback . ,(lambda (m) (ly:music-property m 'elements)))
480         (iterator-ctor . ,ly:sequential-iterator::constructor)
481         (types . (general-music sequential-music))
482         ))
483
484     (SimultaneousMusic
485      . ((description . "Music playing together.
486
487 Syntax: @code{\\simultaneous @{ @dots{} @}} or @code{<< @dots{} >>}")
488         (iterator-ctor . ,ly:simultaneous-music-iterator::constructor)
489         (start-callback . ,ly:music-sequence::minimum-start-callback)
490         (length-callback . ,ly:music-sequence::maximum-length-callback)
491         (to-relative-callback .
492          ,ly:music-sequence::simultaneous-relative-callback)
493         (types . (general-music simultaneous-music))
494         ))
495
496     (SkipEvent
497      . ((description . "Filler that takes up duration, but does not
498 print anything.
499
500 Syntax: @code{s4} for a skip equivalent to a quarter rest.")
501         (types . (general-music event rhythmic-event skip-event))
502         ))
503
504     (SkipMusic
505      . ((description . "Filler that takes up duration, does not
506 print anything, and also does not create staves or voices implicitly.
507
508 Syntax: @code{\\skip} @var{duration}")
509         (length-callback . ,ly:music-duration-length)
510         (iterator-ctor . ,ly:simple-music-iterator::constructor)
511         (types . (general-music event rhythmic-event skip-event))
512         ))
513
514     (SlurEvent
515      . ((description . "Start or end slur.
516
517 Syntax: @var{note}@code{(} and @var{note}@code{)}")
518         (types . (general-music span-event event slur-event))
519         ))
520
521     (SoloOneEvent
522      . ((description . "Print @q{Solo@tie{}1}.")
523         (part-combine-status . solo1)
524         (types . (general-music event part-combine-event solo-one-event))
525         ))
526
527     (SoloTwoEvent
528      . ((description . "Print @q{Solo@tie{}2}.")
529         (part-combine-status . solo2)
530         (types . (general-music event part-combine-event solo-two-event))
531         ))
532
533     (SostenutoEvent
534      . ((description . "Depress or release sostenuto pedal.")
535         (types . (general-music event pedal-event sostenuto-event))
536         ))
537
538     (SpacingSectionEvent
539      . ((description . "Start a new spacing section.")
540         (types . (general-music event spacing-section-event))))
541
542     (SpanEvent
543      . ((description . "Event for anything that is started at a
544 different time than stopped.")
545         (types . (general-music event))
546         ))
547
548     (StaffSpanEvent
549      . ((description . "Start or stop a staff symbol.")
550         (types . (general-music event span-event staff-span-event))
551      ))
552
553     (StringNumberEvent
554      . ((description . "Specify on which string to play this note.
555
556 Syntax: @code{\\@var{number}}")
557         (types . (general-music string-number-event event))
558         ))
559
560     (StrokeFingerEvent
561      . ((description . "Specify with which finger to pluck a string.
562
563 Syntax: @code{\\rightHandFinger @var{text}}")
564         (types . (general-music stroke-finger-event event))
565         ))
566
567     (SustainEvent
568      . ((description . "Depress or release sustain pedal.")
569         (types . (general-music event pedal-event sustain-event))
570         ))
571
572     (TextScriptEvent
573      . ((description . "Print text.")
574         (types . (general-music script-event text-script-event event))
575         ))
576
577     (TextSpanEvent
578      . ((description . "Start a text spanner, for example, an
579 octavation.")
580         (types . (general-music span-event event text-span-event))
581         ))
582
583     (TieEvent
584      . ((description . "A tie.
585
586 Syntax: @var{note}@code{-~}")
587         (types . (general-music tie-event event))
588         ))
589
590     (TimeScaledMusic
591      . ((description . "Multiply durations, as in tuplets.
592
593 Syntax: @code{\\times @var{fraction} @var{music}}, e.g.,
594 @code{\\times 2/3 @{ @dots{} @}} for triplets.")
595         (length-callback . ,ly:music-wrapper::length-callback)
596         (start-callback . ,ly:music-wrapper::start-callback)
597         (iterator-ctor . ,ly:tuplet-iterator::constructor)
598         (types . (time-scaled-music music-wrapper-music general-music))
599         ))
600
601     (TransposedMusic
602      . ((description . "Music that has been transposed.")
603         (iterator-ctor . ,ly:music-wrapper-iterator::constructor)
604         (start-callback . ,ly:music-wrapper::start-callback)
605         (length-callback . ,ly:music-wrapper::length-callback)
606         (to-relative-callback .
607          ,ly:relative-octave-music::no-relative-callback)
608         (types . (music-wrapper-music general-music transposed-music))
609         ))
610
611     (TremoloEvent
612      . ((description . "Unmeasured tremolo.")
613         (types . (general-music event tremolo-event))
614         ))
615
616     (TremoloRepeatedMusic
617      . ((description . "Repeated notes denoted by tremolo beams.")
618         (iterator-ctor . ,ly:chord-tremolo-iterator::constructor)
619         (start-callback .  ,ly:repeated-music::first-start)
620         ;; the length of the repeat is handled by shifting the note logs
621         (length-callback . ,ly:repeated-music::folded-music-length)
622         (types . (general-music repeated-music tremolo-repeated-music))
623         ))
624
625     (TremoloSpanEvent
626      . ((description . "Tremolo over two stems.")
627         (types . (general-music event span-event tremolo-span-event))
628         ))
629
630     (TrillSpanEvent
631      . ((description . "Start a trill spanner.")
632         (types . (general-music span-event event trill-span-event))
633         ))
634
635     (TupletSpanEvent
636      . ((description . "Used internally to signal where tuplet
637 brackets start and stop.")
638         (types . (tuplet-span-event span-event event general-music))
639        ))
640
641     (UnaCordaEvent
642      . ((description . "Depress or release una-corda pedal.")
643         (types . (general-music event pedal-event una-corda-event))
644         ))
645
646     (UnfoldedRepeatedMusic
647      . ((description . "Repeated music which is fully written
648 (and played) out.")
649         (iterator-ctor . ,ly:unfolded-repeat-iterator::constructor)
650         (start-callback .  ,ly:repeated-music::first-start)
651         (types . (general-music repeated-music unfolded-repeated-music))
652         (length-callback . ,ly:repeated-music::unfolded-music-length)
653         ))
654
655     (UnisonoEvent
656      . ((description . "Print @q{a@tie{}2}.")
657         (part-combine-status . unisono)
658         (types . (general-music event part-combine-event unisono-event))))
659
660     (UnrelativableMusic
661      . ((description . "Music that cannot be converted from relative
662 to absolute notation.  For example, transposed music.")
663         (to-relative-callback . ,ly:relative-octave-music::no-relative-callback)
664         (iterator-ctor . ,ly:music-wrapper-iterator::constructor)
665         (length-callback . ,ly:music-wrapper::length-callback)
666         (types . (music-wrapper-music general-music unrelativable-music))
667         ))
668
669     (VoiceSeparator
670      . ((description . "Separate polyphonic voices in simultaneous music.
671
672 Syntax: @code{\\\\}")
673         (types . (separator general-music))
674         ))
675
676     (VoltaRepeatedMusic
677      . ((description . "Repeats with alternatives placed sequentially.")
678         (iterator-ctor . ,ly:volta-repeat-iterator::constructor)
679         (start-callback .  ,ly:repeated-music::first-start)
680         (length-callback . ,ly:repeated-music::volta-music-length)
681         (types . (general-music repeated-music volta-repeated-music))
682         ))
683     ))
684
685 (set! music-descriptions
686       (sort music-descriptions alist<?))
687
688 (define-public music-name-to-property-table (make-vector 59 '()))
689
690 ;; init hash table,
691 ;; transport description to an object property.
692 (set!
693  music-descriptions
694  (map (lambda (x)
695         (set-object-property! (car x)
696                               'music-description
697                               (cdr (assq 'description (cdr x))))
698         (let ((lst (cdr x)))
699           (set! lst (assoc-set! lst 'name (car x)))
700           (set! lst (assq-remove! lst 'description))
701           (hashq-set! music-name-to-property-table (car x) lst)
702           (cons (car x) lst)))
703       music-descriptions))
704
705 (define-safe-public (make-music name . music-properties)
706   "Create a music object of given name, and set its properties
707 according to @code{music-properties}, a list of alternating property symbols
708 and values. E.g:
709   (make-music 'OverrideProperty
710               'symbol 'Stem
711               'grob-property 'thickness
712               'grob-value (* 2 1.5))"
713   (if (not (symbol? name))
714       (ly:error (_ "symbol expected: ~S") name))
715   (let ((props (hashq-ref music-name-to-property-table name '())))
716     (if (not (pair? props))
717         (ly:error (_ "cannot find music object: ~S") name))
718     (let ((m (ly:make-music props)))
719       (define (set-props mus-props)
720         (if (and (not (null? mus-props))
721                  (not (null? (cdr mus-props))))
722             (begin
723               (set! (ly:music-property m (car mus-props)) (cadr mus-props))
724               (set-props (cddr mus-props)))))
725       (set-props music-properties)
726       m)))
727
728 (define-public (make-repeated-music name)
729   (let* ((repeated-music (assoc-get name '(("volta" . VoltaRepeatedMusic)
730                                            ("unfold" . UnfoldedRepeatedMusic)
731                                            ("percent" . PercentRepeatedMusic)
732                                            ("tremolo" . TremoloRepeatedMusic))))
733          (repeated-music-name (if repeated-music
734                                   repeated-music
735                                   (begin
736                                     (ly:warning (_ "unknown repeat type `~S'") name)
737                                     (ly:warning (_ "See define-music-types.scm for supported repeats"))
738                                     'VoltaRepeatedMusic))))
739     (make-music repeated-music-name)))