]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-request.hh
f6bb89cec550bbb5959444a51fbd243aaface993
[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 #Request_chord#
20   Base class only
21  */
22 class Musical_req  : public virtual Request  {
23 public:
24
25   DEFAULTACCESSOR(Lyric_req)
26   DEFAULTACCESSOR(Note_req )
27   DEFAULTACCESSOR(Stem_req )
28   DEFAULTACCESSOR(Melodic_req )
29   DEFAULTACCESSOR(Slur_req )
30   DEFAULTACCESSOR(Beam_req )
31   DEFAULTACCESSOR(Abbreviation_beam_req)
32   DEFAULTACCESSOR(Rhythmic_req)
33   DEFAULTACCESSOR(Musical_script_req)
34   DEFAULTACCESSOR(Text_req)
35   DEFAULTACCESSOR(Rest_req )
36   DEFAULTACCESSOR(Skip_req)
37   DEFAULTACCESSOR(Dynamic_req)
38   DEFAULTACCESSOR(Absolute_dynamic_req )
39   DEFAULTACCESSOR(Tie_req )
40   DEFAULTACCESSOR(Plet_req)
41   DEFAULTACCESSOR(Span_dynamic_req )
42   DEFAULTACCESSOR(Abbreviation_req)
43   DEFAULTACCESSOR(Multi_measure_rest_req)
44   REQUESTMETHODS(Musical_req);
45 };
46
47
48
49 /** a request with a duration.
50   This request is used only a base class.
51  */
52 class Rhythmic_req  : public virtual Musical_req  {
53 public:
54   Duration duration_;
55     
56   /* *************** */
57   void set_duration (Duration);
58   bool do_equal_b (Request*) const;
59   virtual Moment duration() const;
60   Rhythmic_req();
61   static int compare (Rhythmic_req const&,Rhythmic_req const&);
62   REQUESTMETHODS(Rhythmic_req);
63 };
64
65 class Skip_req  : public Rhythmic_req  {
66 public:
67   REQUESTMETHODS(Skip_req);
68 };
69
70 struct Spacing_req :virtual Request {
71   Moment next;
72   Real distance;
73   Real strength;
74   /* *************** */
75   Spacing_req();
76   REQUESTMETHODS(Spacing_req);
77 };
78
79 struct Abbreviation_req : public Musical_req {
80   REQUESTMETHODS (Abbreviation_req);
81   Abbreviation_req ();
82   int type_i_;
83 };
84
85 class Blank_req  : public Spacing_req, Rhythmic_req  {
86 public:
87   REQUESTMETHODS(Spacing_req);
88 };
89
90 /// Put a text above or below (?) this staff.
91 class Text_req  : public virtual Musical_req  {
92 public:
93   /// preferred position (above/below)
94   Direction dir_;
95   /// the characteristics of the text
96   Text_def *tdef_p_;
97
98   /* *************** */
99   Text_req (int d, Text_def*);
100   ~Text_req();
101   Text_req (Text_req const&);
102
103   REQUESTMETHODS(Text_req);
104 };
105
106 /** a syllable  or lyric is a string with rhythm.
107   */
108 class Lyric_req  : public  Rhythmic_req  {
109 public:
110   String text_str_;
111   REQUESTMETHODS(Lyric_req);
112 };
113
114
115
116 /// request which has some kind of pitch
117 struct Melodic_req :virtual Musical_req
118 {
119   Musical_pitch pitch_;
120   /// transpose. #delta# is relative to central c.
121   virtual void transpose (Musical_pitch delta);
122   Melodic_req();
123   bool do_equal_b (Request*) const;
124   static int compare (Melodic_req const&,Melodic_req const&);
125   REQUESTMETHODS(Melodic_req);
126 };
127
128 /// Put a note of specified type, height, and with accidental on the staff.
129 class Note_req  : public Rhythmic_req, virtual public Melodic_req  {
130 public:
131     
132   /// force/supress printing of accidental.
133   bool forceacc_b_;
134   Note_req();
135   bool do_equal_b (Request*) const;
136   Rhythmic_req* access_Rhythmic_req () { return Rhythmic_req::access_Rhythmic_req (); }
137   REQUESTMETHODS(Note_req);
138 };
139
140 /**
141 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.
142 */
143 class Rest_req : public Rhythmic_req {
144 public:
145   REQUESTMETHODS(Rest_req);
146 };
147
148 /**
149  Part: typeset a measure with the number of measures rest
150  Score: typeset all individual measures ass full rests
151  */
152 class Multi_measure_rest_req : public Rhythmic_req  {
153 public:
154   REQUESTMETHODS(Multi_measure_rest_req);
155
156 };
157
158 /**
159   Requests to start or stop something.
160  This type of request typically results in the creation of a #Spanner#
161 */
162 class Span_req  : public virtual Musical_req  {
163 public:
164   /// should the spanner start or stop, or is it unwanted?
165   enum Spantype {
166     NOSPAN, START, STOP
167   } spantype;
168   bool do_equal_b (Request*) const;
169   REQUESTMETHODS(Span_req);
170
171   Span_req();
172   
173 };
174
175 /** Start / stop a beam at this note */
176 class Beam_req  : public Span_req  {
177 public:
178   /* *************** */
179   REQUESTMETHODS(Beam_req);
180
181   Beam_req();
182 };
183
184 /** 
185  Start / stop an abbreviation beam at this note. 
186  */
187 class Abbreviation_beam_req : public Span_req  {
188 public:
189   REQUESTMETHODS (Abbreviation_beam_req);
190
191   Abbreviation_beam_req ();
192
193   int type_i_;
194 };
195
196 /**
197   Start a tie at this voice element, end it at the next
198  */
199 class Tie_req : public Musical_req {
200 public:
201   REQUESTMETHODS(Tie_req);
202 };
203
204 /// a slur
205 class Slur_req  : public Span_req  {
206 public:
207   REQUESTMETHODS(Slur_req);
208
209 };
210
211 /// a plet (bracket with) number
212 class Plet_req : public Span_req  {
213 public:
214   int plet_i_;
215
216   REQUESTMETHODS(Plet_req);
217   Plet_req ();
218 };
219
220 class Musical_script_req : public Musical_req,  public Script_req {
221 public:
222   REQUESTMETHODS(Musical_script_req);
223 };
224
225
226 class Dynamic_req  : public virtual Musical_req  {
227 public:
228   /**
229     for absolute dynamics
230
231     This sux. We'd want increasing numbers for FFF till PPP, but not 
232     for FP, SF, SFZ (FP is *not* louder than FFF)
233    */
234   enum Loudness {
235     FFF, FF, F, MF, MP, P, PP, PPP, FP, SF, SFZ
236   };
237   static String loudness_static_str (Loudness);
238   REQUESTMETHODS(Dynamic_req);
239 };
240
241 class Absolute_dynamic_req  : public Dynamic_req  {
242 public:
243   Loudness loudness_;
244   virtual bool do_equal_b (Request*) const;
245   String loudness_str () const;
246   Absolute_dynamic_req();
247   REQUESTMETHODS(Absolute_dynamic_req);
248 };
249
250 class Span_dynamic_req  : public Dynamic_req, public Span_req  {
251 public:
252   virtual bool do_equal_b (Request*) const;
253   /// Grow or shrink the volume: 1=cresc, -1 = decresc 
254   Direction dynamic_dir_;
255   Span_dynamic_req();
256   REQUESTMETHODS(Span_dynamic_req);
257 };
258
259 #endif // MUSICALREQUESTS_HH