]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/repeated-music.hh
5b07584762da8d5ec64fe454486dc5472d2f97a5
[lilypond.git] / lily / include / repeated-music.hh
1 /*   
2   repeated-music.hh -- declare Repeated_music
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c)  1999--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef RepEATED_MUSIC_HH
11 #define RepEATED_MUSIC_HH
12
13 #include "music.hh"
14
15
16 /**
17    Musical repeats.
18
19    A repeat, when played has the form of BODY A BODY B BODY C.
20
21    In this examples, the list {A B C} is put in ALTERNATIVES_P_.  BODY
22    is put in REPEAT_BODY_P_.  Either the body or the alternative may
23    be omitted.
24
25    There are three modes of representing this  music:
26
27    BODY A
28         B
29         C
30
31    is called "folded". Mostly used for lyrics.
32
33    
34    BODY A B C
35
36    is called volta.  This is common notation
37
38    BODY A BODY B BODY C
39
40    is called unfolded.  Useful for MIDI.
41
42    If the number of repeats is smaller than the number of alternatives, then
43    the excess alternatives are ignored for all timing purposes.
44
45    If the number of repeats is bigger than the number of alternatives, then
46    the first alternative is assumed to be repeated.
47    
48 */
49 class Repeated_music : public Music
50 {
51 public:
52   Music * body () const;
53   SCM alternatives () const;
54
55   /// how often do we repeat?
56   int repeat_count ( ) const;
57   virtual Pitch to_relative_octave (Pitch);
58
59   Moment body_get_length () const;
60   Moment alternatives_get_length (bool fold) const;
61   Moment alternatives_volta_get_length () const;  
62
63   DECLARE_SCHEME_CALLBACK (unfolded_music_length, (SCM));
64   DECLARE_SCHEME_CALLBACK (volta_music_length, (SCM));
65   DECLARE_SCHEME_CALLBACK (folded_music_length, (SCM));    
66   DECLARE_SCHEME_CALLBACK (minimum_start, (SCM));
67   DECLARE_SCHEME_CALLBACK (first_start, (SCM));    
68   
69   VIRTUAL_COPY_CONS (Music);
70   Repeated_music ();
71   Repeated_music (SCM);
72 };
73
74
75 #endif /* RepEATED_MUSIC_HH */