]> git.donarmstrong.com Git - lilypond.git/blob - scm/music-types.scm
*** empty log message ***
[lilypond.git] / scm / music-types.scm
1
2 (define-public music-descriptions
3   `(
4     (AbortEvent
5      . (
6         (description .  "Abort currently running spanners.")
7         (internal-class-name . "Request")
8         (span-type . "abort")
9         (types . (general-music event abort-event))
10         ))
11     (ArpeggioEvent 
12      . (
13         (description .  "Make an arpeggio on this note. Syntax:
14 @var{note}-@code{\\arpeggio}")
15         (internal-class-name .  "Request")
16         (types . (general-music arpeggio-event event))
17         ))
18
19     ;; todo: use articulation-event for slur as well.
20     ;; separate non articulation scripts  
21     (ArticulationEvent
22      . (
23         (description .  "")
24
25         (internal-class-name . "Request")
26         (types . (general-music event articulation-event script-event))
27         )) 
28        (AutoChangeMusic
29      . (
30         (description .  "")
31
32         (internal-class-name . "Music_wrapper")
33         (iterator-ctor . ,Auto_change_iterator::constructor)
34         (types . (general-music music-wrapper-music auto-change-instruction))
35         ))
36      (BarCheck
37       . (
38         (description .  "")
39
40          (internal-class-name . "Music")
41          (types . (general-music bar-check))
42          (iterator-ctor . ,Bar_check_iterator::constructor)
43          ))
44     (BassFigureEvent
45      . (
46         (description .  "")
47
48         (internal-class-name . "Request")
49         (types . (general-music event rhythmic-event bass-figure-event))
50         ))
51     (BeamEvent
52      . (
53         (description .  "")
54
55         (internal-class-name . "Request")
56         (types . (general-music event beam-event span-event))
57         ))
58     (BreakEvent
59      . (
60         (description .  "")
61
62         (internal-class-name . "Request")
63         (types . (general-music break-event event))
64         ))
65     (BreathingSignEvent
66      . (
67         (description .  "")
68
69         (internal-class-name . "Request")
70         (types . (general-music event breathing-event))
71         )) 
72     (BusyPlayingEvent
73      . (
74         (description .  "")
75
76         (internal-class-name . "Request")
77         (types . (general-music event busy-playing-event))
78         )) 
79     (ContextSpeccedMusic
80      . (
81         (description .  "")
82
83         (internal-class-name . "Context_specced_music")
84         (types . (context-specification general-music music-wrapper-music))
85         ))
86    (CrescendoEvent
87      . (
88         (description .  "")
89
90         (internal-class-name . "Request")
91         (types . (general-music dynamic-event crescendo-event event))
92         )) 
93     (DecrescendoEvent
94      . (
95         (description .  "")
96
97         (internal-class-name . "Request")
98         (types . (general-music dynamic-event decrescendo-event event))
99         )) 
100    (ExtenderEvent
101      . (
102         (description .  "")
103
104         (internal-class-name . "Request")
105         (types . (general-music extender-event event))
106         ))   
107     (GlissandoEvent
108      . (
109         (description .  "")
110
111         (internal-class-name . "Request")
112         (types . (general-music glissando-event event))
113         )) 
114     (GraceMusic
115      . (
116         (description .  "")
117
118         (internal-class-name . "Grace_music")
119         (iterator-ctor . ,Grace_iterator::constructor)
120         (types . (grace-music music-wrapper-music general-music))
121         ))
122    (HyphenEvent
123      . (
124         (description .  "")
125
126         (internal-class-name . "Request")
127         (types . (general-music hyphen-event event))
128         ))   
129     (KeyChangeEvent
130      . (
131         (description .  "")
132
133         (internal-class-name . "Key_change_req")
134         (types . (general-music key-change-event event))
135         )) 
136       (LyricCombineMusic
137      . (
138         (description .  "")
139
140         (internal-class-name . "Lyric_combine_music")
141         (types . (general-music lyric-combine-music))
142         (iterator-ctor . ,Lyric_combine_music_iterator::constructor)
143         ))
144
145   (LyricEvent
146      . (
147         (description .  "A lyric syllable. Must be entered in lyrics mode, i.e.
148 @code{\\lyrics @{ twinkle4 twinkle4 @} } .")
149
150         (internal-class-name . "Request")
151         (types . (general-music rhythmic-event lyric-event event))
152         ))
153     (LigatureEvent
154      . (
155         (description .  "")
156
157         (internal-class-name . "Request")
158         (span-type . ligature)
159         (types . (general-music event span-event ligature-event))
160         ))
161     (MarkEvent
162      . (
163         (description .  "")
164
165         (internal-class-name . "Request")
166         (types . (general-music mark-event event))
167         ))  
168     (MelismaEvent
169      . (
170         (description .  "")
171
172         (internal-class-name . "Request")
173         (types . (general-music span-event melisma-playing-event event))
174         )) 
175     (MelismaPlayingEvent
176      . (
177         (description .  "")
178
179         (internal-class-name . "Request")
180         (types . (general-music event))
181         ))
182     (MultiMeasureRestEvent
183      . (
184         (description . "Rests that may be compressed into Multi rests. Syntax
185 @code{R2.*4} for 4 measures in 3/4 time. Note the capital R.")
186         (internal-class-name . "Request")
187         (types . (general-music event multi-measure-rest-event))
188         ))
189     (Music
190      . (
191         (description .  "")
192
193         (internal-class-name . "Music")
194         (types . (general-music)) 
195         ))
196     (NoteEvent
197      . (
198         (description .  "")
199
200         (internal-class-name . "Request")
201         (types . (general-music event note-event rhythmic-event melodic-event))
202         ))
203  (OverrideProperty
204       . (
205         (description .  "")
206
207          (internal-class-name . "Music")
208          (types . (general-music layout-instruction))
209          (iterator-ctor . ,     Push_property_iterator::constructor)
210          ))
211
212  (PartCombineMusic
213      . (
214         (description .  "")
215
216         (internal-class-name . "Part_combine_music")
217         (types . (general-music part-combine-music))
218         (iterator-ctor . ,Part_combine_music_iterator::constructor)
219      ))
220       (PhrasingSlurEvent
221      . (
222         (description . "Start or end phrasing slur. Syntax NOTE \\(  and \\) NOTE")
223         (internal-class-name . "Request")
224         (types . (general-music span-event phrasing-slur-event slur-event))
225         ))
226     (PropertySet
227      . (
228         (description .  "")
229         (internal-class-name . "Music")
230         (types . (layout-instruction general-music))
231         (iterator-ctor . ,Property_iterator::constructor)
232         )
233      )
234      (PropertyUnset
235      . (
236         (description .  "")
237
238         (internal-class-name . "Music")
239         (types . (layout-instruction general-music))
240         (iterator-ctor . ,Property_unset_iterator::constructor)
241         )
242      )
243      (PorrectusEvent
244      . (
245         (description .  "")
246
247         (internal-class-name . "Request")
248         (types . (general-music porrectus-event event))
249         ))
250     (RepeatedMusic
251      . (
252         (description .  "")
253
254         (internal-class-name . "Repeated_music")
255         (type .  repeated-music)
256         (types . (general-music repeated-music))
257         ))
258     (Request
259      . (
260         (description .  "")
261
262         (internal-class-name . "Request")
263         (types . (general-music event))
264         )) 
265     (RestEvent
266      . (
267         (description .  "")
268
269         (internal-class-name . "Request")
270         (types . (general-music event rhythmic-event rest-event))
271         )) 
272     (SequentialMusic
273      . (
274         (description .  "Music expressions concatenated. Syntax \\sequential @{..@} or simply @{..@} .")
275
276         (internal-class-name . "Sequential_music")
277         (iterator-ctor . ,Sequential_music_iterator::constructor)
278         (types . (general-music sequential-music))
279         ))
280     (SimultaneousMusic
281      . (
282         (description .  "Music playing together. Syntax: \\simultaneous @{ .. @} or < .. >.")
283
284         (internal-class-name . "Simultaneous_music")
285         (iterator-ctor . ,Simultaneous_music_iterator::constructor)
286         
287         (types . (general-music simultaneous-music))
288         ))
289     (SlurEvent
290      . (
291         (description . "Start or end slur. Syntax NOTE(  and )NOTE")
292         (internal-class-name . "Request")
293         (types . (general-music span-event slur-event))
294         ))
295
296     (RevertProperty
297       . (
298         (description .  "")
299
300          (internal-class-name . "Music")
301          (types . (general-music layout-instruction))
302          (iterator-ctor . ,     Pop_property_iterator::constructor)
303          ))
304      
305     (OutputPropertySetMusic
306      . (
307         (description .  "")
308
309         (internal-class-name . "Music")
310         (iterator-ctor . ,Output_property_music_iterator::constructor)
311         (types . (general-music layout-instruction))
312         ))
313    
314     (TextSpanEvent
315      . (
316         (description . "Start a text spanner like 8va.....|")
317         (internal-class-name . "Request")
318         (types . (general-music span-event text-span-event))
319         ))
320     (TranslatorChange
321      . (
322         (description .  "")
323
324         (internal-class-name . "Music")
325         (iterator-ctor . , Change_iterator::constructor)
326         (types . (general-music translator-change-instruction))
327         ))
328     (TimeScaledMusic
329      . (
330         (description .  "")
331         (internal-class-name . "Time_scaled_music")
332         (iterator-ctor . ,Time_scaled_music_iterator::constructor)
333         (types . (time-scaled-music music-wrapper-music general-music))
334         ))
335     (TransposedMusic
336      . (
337         (description .  "")
338
339         (internal-class-name . "Transposed_music")
340         (types . (music-wrapper-music general-music transposed-music))
341         ))
342
343     (UntransposableMusic
344      . (
345         (description .  "")
346
347         (internal-class-name . "Untransposable_music")
348         (types . (music-wrapper-music general-music untransposable-music)) 
349         ))
350
351     (UnrelativableMusic
352      . (
353         (description .  "")
354
355         (internal-class-name . "Un_relativable_music")
356         (types . (music-wrapper-music general-music unrelativable-music))
357         ))
358
359     (RelativeOctaveMusic
360      . (
361         (description .  "")
362
363         (internal-class-name . "Relative_octave_music")
364         (types . (music-wrapper-music general-music relative-octave-music))
365         ))
366
367   
368     (RequestChord
369      . (
370         (description .  "")
371
372         (internal-class-name . "Request_chord")
373         (iterator-ctor . ,Request_chord_iterator::constructor)
374         (types . (general-music request-chord simultaneous-music))
375         )
376      )
377      
378     (ScriptEvent
379      . (
380         (description .  "")
381
382         (internal-class-name . "Request")
383         (types . (general-music event))
384         )) 
385     (SkipEvent
386      . (
387         (description .  "")
388
389         (internal-class-name . "Request")
390         (types . (general-music event rhythmic-event skip-event))
391         )) 
392     (SpanEvent
393      . (
394         (description .  "")
395
396         (internal-class-name . "Request")
397         (types . (general-music event))
398         )) 
399     (SustainPedalEvent
400       . (
401          (description . "")
402          (internal-class-name . "Request")
403          (types . (general-music pedal-event sustain-pedal-event))
404          ))
405     (SostenutoEvent
406       . (
407          (description . "")
408          (internal-class-name . "Request")
409          (types . (general-music pedal-event sostenuto-pedal-event))
410          ))
411     (UnaCordaEvent
412       . (
413          (description . "")
414          (internal-class-name . "Request")
415          (types . (general-music pedal-event una-corda-pedal-event))
416          ))
417     (StringNumberEvent
418      . (
419         (description .  "")
420
421         (internal-class-name . "Request")
422         (types . (general-music string-number-event event))
423         )) 
424     (TempoEvent
425      . (
426         (description .  "")
427
428         (internal-class-name . "Request")
429         (types . (general-music tempo-event event))
430         )) 
431     (TextScriptEvent
432      . (
433         (description .  "")
434         (internal-class-name . "Request")
435         (types . (general-music script-event text-script-event event))
436         )) 
437     (TieEvent
438      . (
439         (description .  "A tie. Entered as ~.")
440         (internal-class-name . "Request")
441         (types . (general-music tie-event event))
442         ))
443     (TremoloEvent
444      . (
445         (description . "Un measured tremolo.")
446         (internal-class-name . "Request")
447         (types . (general-music event tremolo-event))
448         ))
449      (VoiceSeparator
450       . (
451         (description .  "")
452
453          (internal-class-name . "Music")
454          (types . (separator general-music))
455          ))
456     
457     ))
458
459 (set! music-descriptions
460       (sort music-descriptions alist<?))
461
462 (define music-name-to-property-table (make-vector 59 '()))
463
464
465 ;; init hash table,
466 ;; transport description to an object property.
467 (set!
468  music-descriptions
469  (map (lambda (x)
470         (set-object-property! (car x)
471                               'music-description
472                               (cdr (assq 'description (cdr x))))
473         (let
474             ((l (cdr x)))
475           (set! l (assoc-set! l 'name (car x)))
476           (set! l (assq-remove!  l 'description))
477           (hashq-set! music-name-to-property-table (car x) l)
478           (cons (car x) l)
479           ))
480       music-descriptions))
481
482
483
484 (define-public (make-music-by-name x)
485   (if (not (symbol? x))
486       (misc-error "Not a symbol: ~s" x))
487   (let*
488       (
489        (props (hashq-ref music-name-to-property-table x '()))
490        (name (if (pair? props)
491                  (cdr (assoc 'internal-class-name props))
492                  (error "Can not find music object" x)))
493        )
494
495     (if (eq? props '())
496         (ly-warn (format "Could not find music type `~a'" x)))  
497     (ly-make-bare-music name props)
498   ))
499
500
501 (define-public (old-span-request->event name)
502   (let
503       (
504        (entry   (assoc
505          name
506          '(
507            ("text" . TextSpanEvent)
508            ("decrescendo" . DecrescendoEvent)
509            ("crescendo" . CrescendoEvent)
510            ("Sustain" . SustainPedalEvent)
511            ("UnaCorda" . UnaCordaEvent)
512            ("Sostenuto" . SostenutoEvent)
513            )))
514        )
515     (if (eq? entry #f)
516         (error (format "Could not find span type ~a" name))
517         
518         (make-music-by-name (cdr entry))
519         )
520   ))