lilypond-1.3.145
[lilypond.git] / hdr / input-music.hh
blob1d7a8caa665355087afc4ad4bce9f4c29ec9ed82
1 /*
2 input-music.hh -- part of LilyPond
4 (c) 1996,97 Han-Wen Nienhuys
5 */
7 #ifndef INPUTMUSIC_HH
8 #define INPUTMUSIC_HH
10 #include "plist.hh"
11 #include "proto.hh"
12 #include "voice.hh"
13 #include "moment.hh"
15 struct Voice_list : public PointerList<Voice*> {
16 void translate_time(Moment dt);
19 /**
21 A set voices.
22 Input_music is anything that can simply be regarded as/converted to
23 a set of voices "cooperating" or independant. It has some basic
24 characteristics that real music has too:
26 - it is rhythmic (it has a length, and can be translated horizontally)
27 - a pitch (it can be transposed)
30 struct Input_music {
31 virtual Voice_list convert()const=0;
32 void check_plet(Voice_element* velt_l);
33 virtual Moment length()const=0;
34 virtual void translate_time(Moment dt)=0;
35 virtual ~Input_music(){}
36 virtual void print() const =0;
37 virtual void set_default_group(String)=0;
38 virtual bool find_plet_start_bo(char c, Moment& moment_r) = 0;
39 virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) = 0;
40 // virtual void transpose(...) const =0;
43 virtual Input_music *clone() const = 0;
44 virtual Simple_music *simple() { return 0; }
47 /// Simple music consists of one voice
48 struct Simple_music : Input_music {
49 Voice voice_;
51 /* *** */
52 virtual Simple_music*simple() { return this; }
53 void add(Voice_element*);
54 virtual void set_default_group(String g) { voice_.set_default_group(g); }
55 virtual Moment length()const;
56 virtual Voice_list convert()const;
57 virtual void translate_time(Moment dt);
58 virtual void print() const;
59 virtual bool find_plet_start_bo(char c, Moment& moment_r);
60 virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
61 virtual Input_music *clone() const {
62 return new Simple_music(*this);
67 /// Complex_music consists of multiple voices
68 struct Complex_music : Input_music {
69 IPointerList<Input_music*> elts;
70 /* *************** */
71 virtual void set_default_group(String g);
72 void add(Input_music*);
73 Complex_music();
74 Complex_music(Complex_music const &);
75 virtual void print() const ;
76 void concatenate(Complex_music*);
77 virtual bool find_plet_start_bo(char c, Moment& moment_r);
78 virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
83 /**
84 A voice like list of music.
86 different music forms which start after each other ( concatenated,
87 stacked "horizontally )
91 struct Music_voice : Complex_music {
94 /* *************** */
95 Moment length()const;
96 virtual void translate_time(Moment dt);
97 virtual Voice_list convert()const;
98 void add_elt(Voice_element*);
99 virtual Input_music *clone() const {
100 return new Music_voice(*this);
102 virtual void print() const ;
106 Multiple musicstuff stacked on top of each other
107 chord like :
109 - different music forms which start at the same time ( stacked "vertically" )
112 struct Music_general_chord : Complex_music {
115 /* *************** */
117 virtual Moment length()const;
118 virtual Voice_list convert()const;
119 virtual void translate_time(Moment dt);
120 void add_elt(Voice_element*);
121 virtual Input_music *clone() const {
122 return new Music_general_chord(*this);
125 virtual void print() const ;
128 struct Multi_voice_chord : Music_general_chord {
129 void set_default_group(String);
130 virtual Input_music *clone() const {
131 return new Multi_voice_chord(*this);
134 struct Voice_group_chord : Music_general_chord {
136 virtual Input_music *clone() const {
137 return new Voice_group_chord(*this);
140 #endif // INPUTMUSIC_HH