]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-request.hh
release: 0.1.65
[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@stack.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   virtual Lyric_req* lreq_l() { return 0; }
26   virtual Note_req *note() { return 0;}
27   virtual Stem_req *stem() { return 0;}
28   virtual Melodic_req *melodic() { return 0; }
29   virtual Slur_req *slur() { return 0 ; }
30   virtual Beam_req *beam() { return 0 ; }
31   virtual Abbreviation_beam_req* abbrev_beam() { return 0 ; }
32   virtual Rhythmic_req*rhythmic() { return 0; }
33   virtual Musical_script_req*musicalscript() { return 0; }
34   virtual Text_req*text() { return 0; }
35   virtual Rest_req *rest() { return 0; }
36   virtual Skip_req* skip() { return 0; }
37   virtual Dynamic_req* dynamic() { return 0; }
38   virtual Absolute_dynamic_req * absdynamic() { return 0; }
39   virtual Tie_req * tie() { return 0; }
40   virtual Plet_req* plet() { return 0; }
41   virtual Span_dynamic_req * span_dynamic() { return 0; }
42   virtual Abbreviation_req* abbrev() { return 0; }
43   virtual Multi_measure_rest_req* multi_measure() { return 0; }
44   REQUESTMETHODS(Musical_req, musical);
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, rhythmic);
63 };
64
65 class Skip_req  : public Rhythmic_req  {
66 public:
67   REQUESTMETHODS(Skip_req, skip);
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, spacing);
77 };
78
79 struct Abbreviation_req : public Musical_req {
80   REQUESTMETHODS (Abbreviation_req, abbrev);
81   Abbreviation_req ();
82   int type_i_;
83 };
84
85 class Blank_req  : public Spacing_req, Rhythmic_req  {
86 public:
87   REQUESTMETHODS(Spacing_req, spacing);
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,text);
104 };
105
106 /** Put a text in lyric_staff
107   @see Lyric_staff
108   */
109 class Lyric_req  : public  Rhythmic_req, public Text_req  {
110 public:
111   Lyric_req (Text_def* t_p);
112   REQUESTMETHODS(Lyric_req, lreq_l);
113 };
114
115
116
117 /// request which has some kind of pitch
118 struct Melodic_req :virtual Musical_req
119 {
120   Musical_pitch pitch_;
121   /// transpose. #delta# is relative to central c.
122   virtual void transpose (Musical_pitch delta);
123   Melodic_req();
124   bool do_equal_b (Request*) const;
125   static int compare (Melodic_req const&,Melodic_req const&);
126   REQUESTMETHODS(Melodic_req,melodic);
127 };
128
129 /// Put a note of specified type, height, and with accidental on the staff.
130 class Note_req  : public Rhythmic_req, virtual public Melodic_req  {
131 public:
132     
133   /// force/supress printing of accidental.
134   bool forceacc_b_;
135   Note_req();
136   bool do_equal_b (Request*) const;
137   Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); }
138   REQUESTMETHODS(Note_req, note);
139 };
140
141 /**
142 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.
143 */
144 class Rest_req : public Rhythmic_req {
145 public:
146   REQUESTMETHODS(Rest_req,rest);
147 };
148
149 /**
150  Part: typeset a measure with the number of measures rest
151  Score: typeset all individual measures ass full rests
152  */
153 class Multi_measure_rest_req : public Rhythmic_req  {
154 public:
155   REQUESTMETHODS(Multi_measure_rest_req, multi_measure);
156
157 };
158
159 /**
160   Requests to start or stop something.
161  This type of request typically results in the creation of a #Spanner#
162 */
163 class Span_req  : public virtual Musical_req  {
164 public:
165   /// should the spanner start or stop, or is it unwanted?
166   enum Spantype {
167     NOSPAN, START, STOP
168   } spantype;
169   bool do_equal_b (Request*) const;
170   REQUESTMETHODS(Span_req,span);
171
172   Span_req();
173   
174 };
175
176 /** Start / stop a beam at this note */
177 class Beam_req  : public Span_req  {
178 public:
179   /* *************** */
180   REQUESTMETHODS(Beam_req,beam);
181
182   Beam_req();
183 };
184
185 /** 
186  Start / stop an abbreviation beam at this note. 
187  */
188 class Abbreviation_beam_req : public Span_req  {
189 public:
190   REQUESTMETHODS (Abbreviation_beam_req, abbrev_beam);
191
192   Abbreviation_beam_req ();
193
194   int type_i_;
195 };
196
197 /**
198   Start a tie at this voice element, end it at the next
199  */
200 class Tie_req : public Musical_req {
201 public:
202   REQUESTMETHODS(Tie_req, tie);
203 };
204
205 /// a slur
206 class Slur_req  : public Span_req  {
207 public:
208   REQUESTMETHODS(Slur_req,slur);
209
210 };
211
212 /// a plet (bracket with) number
213 class Plet_req : public Span_req  {
214 public:
215   int plet_i_;
216
217   REQUESTMETHODS(Plet_req,plet);
218
219   Plet_req ();
220 };
221
222 class Musical_script_req : public Musical_req,  public Script_req {
223 public:
224   REQUESTMETHODS(Musical_script_req, musicalscript);
225 };
226
227
228 class Dynamic_req  : public virtual Musical_req  {
229 public:
230   /**
231     for absolute dynamics
232
233     This sux. We'd want increasing numbers for FFF till PPP, but not 
234     for FP, SF, SFZ (FP is *not* louder than FFF)
235    */
236   enum Loudness {
237     FFF, FF, F, MF, MP, P, PP, PPP, FP, SF, SFZ
238   };
239   static String loudness_static_str (Loudness);
240   REQUESTMETHODS(Dynamic_req, dynamic);
241 };
242
243 class Absolute_dynamic_req  : public Dynamic_req  {
244 public:
245   Loudness loudness_;
246   virtual bool do_equal_b (Request*) const;
247   String loudness_str () const;
248   Absolute_dynamic_req();
249   REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
250 };
251
252 class Span_dynamic_req  : public Dynamic_req, public Span_req  {
253 public:
254   /// Grow or shrink the volume: 1=cresc, -1 = decresc 
255   Direction dynamic_dir_;
256   Span_dynamic_req();
257   REQUESTMETHODS(Span_dynamic_req, span_dynamic);
258 };
259
260 #endif // MUSICALREQUESTS_HH