]> git.donarmstrong.com Git - lilypond.git/blob - hdr/inputmusic.hh
release: 0.0.17
[lilypond.git] / hdr / inputmusic.hh
1 /*
2   inputmusic.hh -- part of LilyPond
3
4   (c) 1996 Han-Wen Nienhuys
5 */
6
7 #ifndef INPUTMUSIC_HH
8 #define INPUTMUSIC_HH
9
10 #include "plist.hh"
11 #include "proto.hh"
12 #include "voice.hh"
13
14 struct Voice_list : public PointerList<Voice*> {
15     void translate_time(Real dt);
16 };
17
18 /// ABC for input structures
19 struct Input_music {
20     virtual Voice_list convert()=0;
21     virtual Real length()=0;
22     virtual void translate_time(Real dt)=0;
23     virtual ~Input_music(){}
24     virtual void print() const =0;
25     // virtual void transpose(...) const =0;
26     
27     
28     virtual Input_music *clone() const = 0;
29     virtual Simple_music *simple() { return 0; }
30 };
31 /**
32
33   Input_music is anything that can simply be regarded as/converted to
34   a set of voices "cooperating" or independant. It has some basic
35   characteristics that real music has too:
36
37   - it is rhythmic (it has a length, and can be translated horizontally)
38   - a pitch (it can be transposed)
39
40   */
41
42
43 /// Simple music consists of one voice
44 struct Simple_music : Input_music {
45     Voice voice_;
46
47     /****/
48     virtual Simple_music*simple() { return this; }  
49     void add(Voice_element*);
50     virtual Real length();
51     virtual Voice_list convert();
52     virtual void translate_time(Real dt);
53     virtual void print() const;
54     virtual Input_music *clone() const {
55         return new Simple_music(*this);
56     }
57
58 };
59
60 /// Complex_music consists of multiple voices
61 struct Complex_music : Input_music {
62     IPointerList<Input_music*> elts;
63
64     void add(Input_music*);
65     Complex_music();
66     Complex_music(Complex_music const &);
67     virtual void print() const ;
68     void concatenate(Complex_music*);
69  
70 };
71
72 /// multiple stuff  after each other
73 struct Music_voice : Complex_music {
74  
75     
76     /****************/
77     Real length();
78     virtual void translate_time(Real dt);
79     virtual Voice_list convert();
80     void add_elt(Voice_element*);
81     virtual Input_music *clone() const {
82         return new Music_voice(*this);
83     }
84     virtual void print() const ;
85 };
86 /**
87   voice like.
88
89   different music forms which start after each other ( concatenated,
90   stacked "horizontally )
91  
92  */
93
94 /// Multiple musicstuff stacked on top of each other
95 struct Music_general_chord : Complex_music {
96     IPointerList<Input_music*> chord_;
97
98     /****************/
99
100     virtual Real length();
101     virtual Voice_list convert();
102     virtual void translate_time(Real dt);
103     void add_elt(Voice_element*);
104     virtual Input_music *clone() const {
105         return new Music_general_chord(*this);
106     }
107     
108     virtual void print() const ;
109 };
110 /**
111   chord like :
112
113   - different music forms which start at the same time ( stacked "vertically" )
114   
115   */
116
117
118
119 #endif // INPUTMUSIC_HH