]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-request.hh
release: 1.1.1
[lilypond.git] / lily / include / musical-request.hh
1 /*
2   musical-request.hh -- declare Musical requests
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
12
13 #include "lily-proto.hh"
14 #include "request.hh"
15 #include "duration.hh"
16 #include "musical-pitch.hh"
17
18 /**
19   A request which is coupled to a note (that has duration).
20   Base class only
21  */
22 class Musical_req  : public virtual Request  {
23 public:
24
25
26   REQUESTMETHODS(Musical_req);
27 };
28
29
30
31 /** a request with a duration.
32   This request is used only used as a base class.
33  */
34 class Rhythmic_req  : public virtual Musical_req  {
35 public:
36   Duration duration_;
37     
38   bool do_equal_b (Request*) const;
39   void compress (Moment);
40   virtual Moment duration() const;
41   Rhythmic_req();
42   static int compare (Rhythmic_req const&,Rhythmic_req const&);
43   REQUESTMETHODS(Rhythmic_req);
44 };
45
46 class Skip_req  : public Rhythmic_req  {
47 public:
48   REQUESTMETHODS(Skip_req);
49 };
50
51 struct Spacing_req :virtual Request {
52   Moment next;
53   Real distance;
54   Real strength;
55   Spacing_req();
56   REQUESTMETHODS(Spacing_req);
57 };
58
59 struct Abbreviation_req : public Musical_req {
60   REQUESTMETHODS (Abbreviation_req);
61   Abbreviation_req ();
62   int type_i_;
63 };
64
65 class Blank_req  : public Spacing_req, Rhythmic_req  {
66 public:
67   REQUESTMETHODS(Spacing_req);
68 };
69
70 /// Put a text above or below (?) this staff.
71 class Text_req  : public virtual Musical_req  {
72 public:
73   /// preferred position (above/below)
74   Direction dir_;
75   /// the characteristics of the text
76   Text_def *tdef_p_;
77
78   Text_req (int d, Text_def*);
79   ~Text_req();
80   Text_req (Text_req const&);
81
82   REQUESTMETHODS(Text_req);
83 };
84
85 /** a syllable  or lyric is a string with rhythm.
86   */
87 class Lyric_req  : public  Rhythmic_req  {
88 public:
89   String text_str_;
90   REQUESTMETHODS(Lyric_req);
91 };
92
93
94
95 /// request which has some kind of pitch
96 struct Melodic_req :virtual Musical_req
97 {
98   Musical_pitch pitch_;
99   /// transpose. #delta# is relative to central c.
100   virtual void transpose (Musical_pitch delta);
101   Melodic_req();
102   bool do_equal_b (Request*) const;
103   static int compare (Melodic_req const&,Melodic_req const&);
104   REQUESTMETHODS(Melodic_req);
105 };
106
107 /// Put a note of specified type, height, and with accidental on the staff.
108 class Note_req  : public Rhythmic_req, virtual public Melodic_req  {
109 public:
110     
111   /// force/supress printing of accidental.
112   bool forceacc_b_;
113   Note_req();
114   bool do_equal_b (Request*) const;
115   REQUESTMETHODS(Note_req);
116 };
117
118 /**
119 Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
120 */
121 class Rest_req : public Rhythmic_req {
122 public:
123   REQUESTMETHODS(Rest_req);
124 };
125
126 /**
127  Part: typeset a measure with the number of measures rest
128  Score: typeset all individual measures ass full rests
129  */
130 class Multi_measure_rest_req : public Rhythmic_req  {
131 public:
132   REQUESTMETHODS(Multi_measure_rest_req);
133
134 };
135
136 class Musical_span_req : public Span_req, public virtual Musical_req
137 {
138 public:
139   REQUESTMETHODS(Musical_span_req);
140   
141 };
142
143 /** Start / stop a beam at this note */
144 class Beam_req  : public Musical_span_req  {
145 public:
146   REQUESTMETHODS(Beam_req);
147
148   Beam_req();
149 };
150
151 /** 
152  Start / stop an abbreviation beam at this note. 
153  */
154 class Abbreviation_beam_req : public Musical_span_req  {
155 public:
156   REQUESTMETHODS (Abbreviation_beam_req);
157
158   Abbreviation_beam_req ();
159
160   int type_i_;
161 };
162
163 /**
164   Start a tie at this note, end it at the next
165  */
166 class Tie_req : public Musical_req {
167 public:
168   REQUESTMETHODS(Tie_req);
169 };
170
171 /// a slur
172 class Slur_req  : public Musical_span_req  {
173 public:
174   REQUESTMETHODS(Slur_req);
175
176 };
177
178 /// a plet (bracket with) number
179 class Plet_req : public Musical_span_req  {
180 public:
181   int plet_i_;
182
183   REQUESTMETHODS(Plet_req);
184   Plet_req ();
185 };
186
187 class Musical_script_req : public Musical_req,  public Script_req {
188 public:
189   REQUESTMETHODS(Musical_script_req);
190 };
191
192
193 class Dynamic_req  : public virtual Musical_req  {
194 public:
195   /**
196     for absolute dynamics
197
198     This sux. We'd want increasing numbers for FFF till PPP, but not 
199     for FP, SF, SFZ (FP is *not* louder than FFF)
200    */
201   enum Loudness {
202     FFF, FF, F, MF, MP, P, PP, PPP, FP, SF, SFZ
203   };
204   static String loudness_static_str (Loudness);
205   REQUESTMETHODS(Dynamic_req);
206 };
207
208 class Absolute_dynamic_req  : public Dynamic_req  {
209 public:
210   Loudness loudness_;
211   virtual bool do_equal_b (Request*) const;
212   String loudness_str () const;
213   Absolute_dynamic_req();
214   REQUESTMETHODS(Absolute_dynamic_req);
215 };
216
217 class Span_dynamic_req  : public Dynamic_req, public Musical_span_req  {
218 public:
219   virtual bool do_equal_b (Request*) const;
220   /// Grow or shrink the volume: 1=cresc, -1 = decresc 
221   Direction dynamic_dir_;
222   Span_dynamic_req();
223   REQUESTMETHODS(Span_dynamic_req);
224 };
225
226 #endif // MUSICALREQUESTS_HH