]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-request.hh
release: 1.1.2
[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   /// Cautionary, i.e. parenthesized accidental.
114   bool cautionary_b_;
115   Note_req();
116   bool do_equal_b (Request*) const;
117   REQUESTMETHODS(Note_req);
118 };
119
120 /**
121 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.
122 */
123 class Rest_req : public Rhythmic_req {
124 public:
125   REQUESTMETHODS(Rest_req);
126 };
127
128 /**
129  Part: typeset a measure with the number of measures rest
130  Score: typeset all individual measures ass full rests
131  */
132 class Multi_measure_rest_req : public Rhythmic_req  {
133 public:
134   REQUESTMETHODS(Multi_measure_rest_req);
135
136 };
137
138 class Musical_span_req : public Span_req, public virtual Musical_req
139 {
140 public:
141   REQUESTMETHODS(Musical_span_req);
142   
143 };
144
145 /** Start / stop a beam at this note */
146 class Beam_req  : public Musical_span_req  {
147 public:
148   REQUESTMETHODS(Beam_req);
149
150   Beam_req();
151 };
152
153 /** 
154  Start / stop an abbreviation beam at this note. 
155  */
156 class Abbreviation_beam_req : public Musical_span_req  {
157 public:
158   REQUESTMETHODS (Abbreviation_beam_req);
159
160   Abbreviation_beam_req ();
161
162   int type_i_;
163 };
164
165 /**
166   Start a tie at this note, end it at the next
167  */
168 class Tie_req : public Musical_req {
169 public:
170   REQUESTMETHODS(Tie_req);
171 };
172
173 /// a slur
174 class Slur_req  : public Musical_span_req  {
175 public:
176   REQUESTMETHODS(Slur_req);
177
178 };
179
180 /// a plet (bracket with) number
181 class Plet_req : public Musical_span_req  {
182 public:
183   int plet_i_;
184
185   REQUESTMETHODS(Plet_req);
186   Plet_req ();
187 };
188
189 class Musical_script_req : public Musical_req,  public Script_req {
190 public:
191   REQUESTMETHODS(Musical_script_req);
192 };
193
194
195 class Dynamic_req  : public virtual Musical_req  {
196 public:
197   /**
198     for absolute dynamics
199
200     This sux. We'd want increasing numbers for FFF till PPP, but not 
201     for FP, SF, SFZ (FP is *not* louder than FFF)
202    */
203   enum Loudness {
204     FFF, FF, F, MF, MP, P, PP, PPP, FP, SF, SFZ
205   };
206   static String loudness_static_str (Loudness);
207   REQUESTMETHODS(Dynamic_req);
208 };
209
210 class Absolute_dynamic_req  : public Dynamic_req  {
211 public:
212   Loudness loudness_;
213   virtual bool do_equal_b (Request*) const;
214   String loudness_str () const;
215   Absolute_dynamic_req();
216   REQUESTMETHODS(Absolute_dynamic_req);
217 };
218
219 class Span_dynamic_req  : public Dynamic_req, public Musical_span_req  {
220 public:
221   virtual bool do_equal_b (Request*) const;
222   /// Grow or shrink the volume: 1=cresc, -1 = decresc 
223   Direction dynamic_dir_;
224   Span_dynamic_req();
225   REQUESTMETHODS(Span_dynamic_req);
226 };
227
228 #endif // MUSICALREQUESTS_HH