]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/repeated-music.hh
release: 1.3.73
[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--2000 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 "semi" folded.  This is common notation
37
38    BODY A BODY B BODY C
39
40    is called unfolded.  Useful for MIDI.
41
42
43    If the number of repeats is smaller than the number of alternatives, then
44    the excess alternatives are ignored for all timing purposes.
45
46    If the number of repeats is bigger than the number of alternatives, then
47    the first alternative is assumed to be repeated.
48    
49 */
50 class Repeated_music : public Music
51 {
52   Music * repeat_body_p_;
53   Music_sequence * alternatives_p_;
54 public:
55
56   Music * body () const;
57   Music_sequence * alternatives () const;
58   String type_;
59   
60   bool fold_b_;
61   /// if FOLD_B_ is false, semifold this.
62   bool volta_fold_b_;
63
64   /// how often do we repeat?
65   int repeats_i_;
66   virtual Musical_pitch to_relative_octave (Musical_pitch);
67
68   /// The duration of this piece of music
69   virtual Moment length_mom () const;
70   Moment body_length_mom () const;
71   Moment alternatives_length_mom () const;
72
73   void print() const;
74   /// Transpose, with the interval central C to #p#
75   virtual void transpose (Musical_pitch p);
76
77   /// Scale the music in time by #factor#.
78   virtual void compress (Moment factor);
79   VIRTUAL_COPY_CONS(Music);
80
81   Repeated_music (Music*, int , Music_sequence*);
82   Repeated_music (Repeated_music const&);
83 protected:
84   virtual void do_print() const;
85 };
86
87
88 #endif /* RepEATED_MUSIC_HH */